From 071484c5d8406feeed7305d6a764257feba6bca2 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Wed, 12 Mar 1997 21:28:14 +0000 Subject: [PATCH] From: Dan McGuirk Subject: [HACKERS] timestamp type OK, last one. This patch adds an ANSI SQL 'timestamp' type. --- src/backend/utils/adt/Makefile | 7 +++---- src/include/catalog/pg_operator.h | 8 +++++++- src/include/catalog/pg_proc.h | 11 ++++++++++- src/include/catalog/pg_type.h | 4 +++- src/include/utils/builtins.h | 14 +++++++++++++- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/backend/utils/adt/Makefile b/src/backend/utils/adt/Makefile index 9dff84b5bb..78de1347c7 100644 --- a/src/backend/utils/adt/Makefile +++ b/src/backend/utils/adt/Makefile @@ -4,7 +4,7 @@ # Makefile for utils/adt # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.5 1997/03/09 20:40:50 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.6 1997/03/12 21:27:03 scrappy Exp $ # #------------------------------------------------------------------------- @@ -20,9 +20,8 @@ CFLAGS+=$(INCLUDE_OPT) OBJS = acl.o arrayfuncs.o arrayutils.o bool.o char.o chunk.o date.o \ datum.o dt.o filename.o float.o geo_ops.o geo_selfuncs.o int.o \ misc.o nabstime.o name.o not_in.o numutils.o oid.o \ - oidname.o oidint2.o oidint4.o oracle_compat.o \ - regexp.o regproc.o selfuncs.o \ - tid.o varchar.o varlena.o sets.o datetimes.o like.o + oidname.o oidint2.o oidint4.o oracle_compat.o regexp.o regproc.o selfuncs.o \ + tid.o varchar.o varlena.o sets.o datetimes.o like.o timestamp.o all: SUBSYS.o diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index c4d2b39bee..647e6a948d 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_operator.h,v 1.4 1996/11/14 21:39:11 scrappy Exp $ + * $Id: pg_operator.h,v 1.5 1997/03/12 21:27:18 scrappy Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -463,6 +463,12 @@ DATA(insert OID = 1232 ( "~*" PGUID 0 b t f 1043 25 16 0 1233 0 0 text DATA(insert OID = 1233 ( "!~*" PGUID 0 b t f 1043 25 16 0 1232 0 0 texticregexne neqsel neqjoinsel )); DATA(insert OID = 1234 ( "~*" PGUID 0 b t f 1042 25 16 0 1235 0 0 texticregexeq eqsel eqjoinsel )); DATA(insert OID = 1235 ( "!~*" PGUID 0 b t f 1042 25 16 0 1234 0 0 texticregexne neqsel neqjoinsel )); +DATA(insert OID = 1300 ( "=" PGUID 0 b t t 1296 1296 16 1300 1301 1302 1302 timestampeq eqsel eqjoinsel )); +DATA(insert OID = 1301 ( "<>" PGUID 0 b t f 1296 1296 16 1301 1300 0 0 timestampne neqsel neqjoinsel )); +DATA(insert OID = 1302 ( "<" PGUID 0 b t f 1296 1296 16 1303 1305 0 0 timestamplt intltsel intltjoinsel )); +DATA(insert OID = 1303 ( ">" PGUID 0 b t f 1296 1296 16 1302 1304 0 0 timestampgt intltsel intltjoinsel )); +DATA(insert OID = 1304 ( "<=" PGUID 0 b t f 1296 1296 16 1305 1303 0 0 timestample intltsel intltjoinsel )); +DATA(insert OID = 1305 ( ">=" PGUID 0 b t f 1296 1296 16 1304 1302 0 0 timestampge intltsel intltjoinsel )); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index c12f3d1828..a0ad047f19 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.8 1997/03/04 05:32:11 scrappy Exp $ + * $Id: pg_proc.h,v 1.9 1997/03/12 21:27:28 scrappy Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -757,6 +757,15 @@ DATA(insert OID = 1238 ( texticregexeq PGUID 11 f t f 2 f 16 "25 25" 100 DATA(insert OID = 1239 ( texticregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); DATA(insert OID = 1240 ( nameicregexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); DATA(insert OID = 1241 ( nameicregexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1297 ( timestamp_in PGUID 11 f t f 1 f 1296 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1298 ( timestamp_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1299 ( now PGUID 11 f t f 0 f 1296 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1306 ( timestampeq PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); +DATA(insert OID = 1307 ( timestampne PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); +DATA(insert OID = 1308 ( timestamplt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); +DATA(insert OID = 1309 ( timestampgt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); +DATA(insert OID = 1310 ( timestample PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); +DATA(insert OID = 1311 ( timestampge PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar )); /* Oracle Compatibility Related Functions - By Edmund Mergl */ DATA(insert OID = 1260 ( lower PGUID 11 f t f 1 f 25 "25" 100 0 0 100 foo bar )); diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 350b4ecc27..2246fb83f1 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_type.h,v 1.7 1997/01/14 01:41:57 momjian Exp $ + * $Id: pg_type.h,v 1.8 1997/03/12 21:27:41 scrappy Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -292,6 +292,8 @@ DATA(insert OID = 1082 ( date PGUID 4 10 t b t \054 0 0 date_in date_out DATA(insert OID = 1083 ( time PGUID 8 16 f b t \054 0 0 time_in time_out time_in time_out i _null_ )); DATA(insert OID = 1182 ( _date PGUID -1 -1 f b t \054 0 1082 array_in array_out array_in array_out i _null_ )); DATA(insert OID = 1183 ( _time PGUID -1 -1 f b t \054 0 1083 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1296 ( timestamp PGUID 4 19 t b t \054 0 0 timestamp_in timestamp_out timestamp_in timestamp_out i _null_ )); + /* * prototypes for functions in pg_type.c */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 0e28192a21..a9f1572a3e 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: builtins.h,v 1.10 1997/03/09 20:41:02 momjian Exp $ + * $Id: builtins.h,v 1.11 1997/03/12 21:28:14 scrappy Exp $ * * NOTES * This should normally only be included by fmgr.h. @@ -403,6 +403,18 @@ extern float64 gistnpage(Oid operatorObjectId, Oid indrelid, AttrNumber attribut /* tid.c */ extern ItemPointer tidin(char *str); extern char *tidout(ItemPointer itemPtr); + +/* timestamp.c */ +extern int4 timestamp_in(char *timestamp_str); +extern char *timestamp_out(int4 timestamp); +extern int4 now(void); +int4 timestampeq(int4 t1, int4 t2); +int4 timestampne(int4 t1, int4 t2); +int4 timestamplt(int4 t1, int4 t2); +int4 timestampgt(int4 t1, int4 t2); +int4 timestample(int4 t1, int4 t2); +int4 timestampge(int4 t1, int4 t2); + /* varchar.c */ extern char *bpcharin(char *s, int dummy, int typlen); extern char *bpcharout(char *s); -- 2.40.0