mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
pg_password utility. Cleanup for psql passwords. New datetime contrib stuff for new version. Fix for strutils needing config.h.
This commit is contained in:
@ -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);
|
||||
|
||||
%
|
||||
|
Reference in New Issue
Block a user