Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_password utility. Cleanup for psql passwords. New datetime contrib…
… stuff for new version. Fix for strutils needing config.h.
- Loading branch information
Showing
8 changed files
with
183 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
From: Massimo Dal Zotto <dz@cs.unitn.it> | ||
Date: Tue, 14 May 1996 14:31:18 +0200 (MET DST) | ||
Subject: [PG95]: new postgres functions | ||
|
||
- -----BEGIN PGP SIGNED MESSAGE----- | ||
|
||
Some time ago I read in the mailing list requests of people looking | ||
for more time and date functions. I have now written some of them: | ||
|
||
time_difference(time1, time2) ,also defined as operator '-' | ||
hour(time) | ||
minutes(time) | ||
seconds(time) | ||
asMinutes(time) | ||
asSeconds(time) | ||
currentTime() | ||
currentDate() | ||
|
||
The file can be compiled as shared library and loaded as dynamic module | ||
without need to recompile the backend. This can also be taken as an example | ||
of the extensibility of postgres (user-defined functions, operators, etc). | ||
I would be nice to see more of these user contributed modules posted to this | ||
list and hopefully accessible from the Postgres home page. | ||
Date & time functions for use in Postgres version 6.1 & up | ||
|
||
This functions replaces the original ones from the postgresql.org | ||
because the date & time structures has changed. | ||
|
||
There is a Makefile that should be "ajusted" | ||
for directories where postgres home after install. | ||
|
||
In this case: /usr/postgres. | ||
|
||
Hope this can help, | ||
|
||
|
||
Sergio Lenzi (lenzi@bsi.com.br) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,75 @@ | ||
|
||
-- SQL code to load and define 'datetime' functions | ||
|
||
-- load the new functions | ||
|
||
load '/home/dz/lib/postgres/datetime_functions.so'; | ||
|
||
-- define the new functions in postgres | ||
func=$1 | ||
cat <<% > datetime_functions.sql | ||
drop function time_difference(time,time); | ||
drop function currentdate(); | ||
drop function currenttime(); | ||
drop function hours(time); | ||
drop function minutes(time); | ||
drop function seconds(time); | ||
drop function day(date); | ||
drop function month(date); | ||
drop function year(date); | ||
drop function asminutes(time); | ||
drop function asseconds(time); | ||
drop operator - (time,time); | ||
|
||
create function time_difference(time,time) | ||
returns time | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function currentDate() | ||
create function currentdate() | ||
returns date | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function currentTime() | ||
create function currenttime() | ||
returns time | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function hours(time) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function minutes(time) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function seconds(time) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function day(date) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function month(date) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function year(date) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function asMinutes(time) | ||
create function asminutes(time) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create function asSeconds(time) | ||
create function asseconds(time) | ||
returns int4 | ||
as '/home/dz/lib/postgres/datetime_functions.so' | ||
as '$func' | ||
language 'c'; | ||
|
||
create operator - ( | ||
leftarg=time, | ||
rightarg=time, | ||
procedure=time_difference); | ||
|
||
% |
Oops, something went wrong.