Обсуждение: TODO item - tid <> operator
Please find enclosed a patch that adds a '<>' operator for tid types
(per TODO item). Patch is against current sources (beta4).
If I have understood the requirement properly, the relevant function
'tidne' already existed in src/backend/utils/adt/tid.c, just needed an
ifdef NOT_USED removed. The '<>' operator however, needed to be added.
I have renumbered the OIDs for the various tid functions in order to
keep them together with the 'new' tidne one in pg_proc.h - as we have
run out of OIDs in the old range. Similarly for the '=' operator in
pg_operator.h.
with the patch applied, all 98 regression tests pass, plus it seems to
work ok :-)
test=# select ctid, id from foo where ctid != '(0,1)';
ctid | id
-------+----
(0,2) | 2
(0,3) | 3
(2 rows)
regards
Mark
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.387
diff -c -r1.387 pg_proc.h
*** src/include/catalog/pg_proc.h 15 Oct 2005 02:49:42 -0000 1.387
--- src/include/catalog/pg_proc.h 24 Oct 2005 02:34:49 -0000
***************
*** 1625,1637 ****
DATA(insert OID = 1291 ( array_length_coerce PGNSP PGUID 12 f f t f s 3 2277 "2277 23 16" _null_ _null_ _null_
array_length_coerce- _null_ ));
DESCR("adjust any array to new element typmod");
- DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
- DESCR("equal");
- DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
- DESCR("latest tid of a tuple");
- DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
- DESCR("latest tid of a tuple");
-
DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 f f t f v 1 20 "19" _null_ _null_ _null_
pg_database_size_name- _null_ ));
DESCR("Calculate total disk space usage for the specified database");
--- 1625,1630 ----
***************
*** 3765,3770 ****
--- 3758,3772 ----
DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 f f t f i 1 2281 "2281" _null_ _null_ _null_
gist_circle_compress- _null_ ));
DESCR("GiST support");
+ /* Tid functions */
+ DATA(insert OID = 2601 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
+ DESCR("equal");
+ DATA(insert OID = 2602 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
+ DESCR("latest tid of a tuple");
+ DATA(insert OID = 2603 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
+ DESCR("latest tid of a tuple");
+ DATA(insert OID = 2604 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne -
_null_));
+ DESCR("not equal");
/*
* Symbolic values for provolatile column: these indicate whether the result
Index: src/include/catalog/pg_operator.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
retrieving revision 1.137
diff -c -r1.137 pg_operator.h
*** src/include/catalog/pg_operator.h 15 Oct 2005 02:49:42 -0000 1.137
--- src/include/catalog/pg_operator.h 24 Oct 2005 02:34:50 -0000
***************
*** 128,135 ****
DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel
eqjoinsel));
! #define TIDEqualOperator 387
DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
--- 128,136 ----
DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
! DATA(insert OID = 390 ( "<>" PGNSP PGUID b f 27 27 16 390 0 0 0 0 0 tidne neqsel
neqjoinsel));
! DATA(insert OID = 391 ( "=" PGNSP PGUID b f 27 27 16 391 0 0 0 0 0 tideq eqsel
eqjoinsel));
! #define TIDEqualOperator 391
DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
Index: src/backend/utils/adt/tid.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v
retrieving revision 1.49
diff -c -r1.49 tid.c
*** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
--- src/backend/utils/adt/tid.c 24 Oct 2005 02:34:51 -0000
***************
*** 174,180 ****
arg1->ip_posid == arg2->ip_posid);
}
- #ifdef NOT_USED
Datum
tidne(PG_FUNCTION_ARGS)
{
--- 174,179 ----
***************
*** 185,191 ****
BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
arg1->ip_posid != arg2->ip_posid);
}
- #endif
/*
* Functions to get latest tid of a specified tuple.
--- 184,189 ----
On Mon, 2005-24-10 at 20:09 +1300, Mark Kirkwood wrote:
> *** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
> --- src/backend/utils/adt/tid.c 24 Oct 2005 02:34:51 -0000
> ***************
> *** 174,180 ****
> arg1->ip_posid == arg2->ip_posid);
> }
>
> - #ifdef NOT_USED
> Datum
> tidne(PG_FUNCTION_ARGS)
> {
> --- 174,179 ----
> ***************
> *** 185,191 ****
> BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
> arg1->ip_posid != arg2->ip_posid);
> }
> - #endif
>
> /*
> * Functions to get latest tid of a specified tuple.
You also probably want to add the declaration for tidne() to
include/utils/builtins.h
-Neil
Neil Conway wrote:
>
> You also probably want to add the declaration for tidne() to
> include/utils/builtins.h
>
Doh! - Indeed, I obviously missed a few extra compile warnings!
Revised patch attached.
Index: src/backend/utils/adt/tid.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v
retrieving revision 1.49
diff -c -r1.49 tid.c
*** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
--- src/backend/utils/adt/tid.c 24 Oct 2005 20:55:57 -0000
***************
*** 174,180 ****
arg1->ip_posid == arg2->ip_posid);
}
- #ifdef NOT_USED
Datum
tidne(PG_FUNCTION_ARGS)
{
--- 174,179 ----
***************
*** 185,191 ****
BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
arg1->ip_posid != arg2->ip_posid);
}
- #endif
/*
* Functions to get latest tid of a specified tuple.
--- 184,189 ----
Index: src/include/utils/builtins.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v
retrieving revision 1.267
diff -c -r1.267 builtins.h
*** src/include/utils/builtins.h 18 Oct 2005 20:38:58 -0000 1.267
--- src/include/utils/builtins.h 24 Oct 2005 20:55:58 -0000
***************
*** 530,535 ****
--- 530,536 ----
extern Datum tidrecv(PG_FUNCTION_ARGS);
extern Datum tidsend(PG_FUNCTION_ARGS);
extern Datum tideq(PG_FUNCTION_ARGS);
+ extern Datum tidne(PG_FUNCTION_ARGS);
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.387
diff -c -r1.387 pg_proc.h
*** src/include/catalog/pg_proc.h 15 Oct 2005 02:49:42 -0000 1.387
--- src/include/catalog/pg_proc.h 24 Oct 2005 20:56:01 -0000
***************
*** 1625,1637 ****
DATA(insert OID = 1291 ( array_length_coerce PGNSP PGUID 12 f f t f s 3 2277 "2277 23 16" _null_ _null_ _null_
array_length_coerce- _null_ ));
DESCR("adjust any array to new element typmod");
- DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
- DESCR("equal");
- DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
- DESCR("latest tid of a tuple");
- DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
- DESCR("latest tid of a tuple");
-
DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 f f t f v 1 20 "19" _null_ _null_ _null_
pg_database_size_name- _null_ ));
DESCR("Calculate total disk space usage for the specified database");
--- 1625,1630 ----
***************
*** 3765,3770 ****
--- 3758,3772 ----
DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 f f t f i 1 2281 "2281" _null_ _null_ _null_
gist_circle_compress- _null_ ));
DESCR("GiST support");
+ /* Tid functions */
+ DATA(insert OID = 2601 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
+ DESCR("equal");
+ DATA(insert OID = 2602 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
+ DESCR("latest tid of a tuple");
+ DATA(insert OID = 2603 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
+ DESCR("latest tid of a tuple");
+ DATA(insert OID = 2604 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne -
_null_));
+ DESCR("not equal");
/*
* Symbolic values for provolatile column: these indicate whether the result
Index: src/include/catalog/pg_operator.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
retrieving revision 1.137
diff -c -r1.137 pg_operator.h
*** src/include/catalog/pg_operator.h 15 Oct 2005 02:49:42 -0000 1.137
--- src/include/catalog/pg_operator.h 24 Oct 2005 20:56:02 -0000
***************
*** 128,135 ****
DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel
eqjoinsel));
! #define TIDEqualOperator 387
DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
--- 128,136 ----
DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
! DATA(insert OID = 390 ( "<>" PGNSP PGUID b f 27 27 16 390 0 0 0 0 0 tidne neqsel
neqjoinsel));
! DATA(insert OID = 391 ( "=" PGNSP PGUID b f 27 27 16 391 0 0 0 0 0 tideq eqsel
eqjoinsel));
! #define TIDEqualOperator 391
DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
This has been saved for the 8.2 release:
http://momjian.postgresql.org/cgi-bin/pgpatches_hold
---------------------------------------------------------------------------
Mark Kirkwood wrote:
> Neil Conway wrote:
>
> >
> > You also probably want to add the declaration for tidne() to
> > include/utils/builtins.h
> >
>
> Doh! - Indeed, I obviously missed a few extra compile warnings!
>
> Revised patch attached.
>
>
>
>
> Index: src/backend/utils/adt/tid.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v
> retrieving revision 1.49
> diff -c -r1.49 tid.c
> *** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
> --- src/backend/utils/adt/tid.c 24 Oct 2005 20:55:57 -0000
> ***************
> *** 174,180 ****
> arg1->ip_posid == arg2->ip_posid);
> }
>
> - #ifdef NOT_USED
> Datum
> tidne(PG_FUNCTION_ARGS)
> {
> --- 174,179 ----
> ***************
> *** 185,191 ****
> BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
> arg1->ip_posid != arg2->ip_posid);
> }
> - #endif
>
> /*
> * Functions to get latest tid of a specified tuple.
> --- 184,189 ----
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v
> retrieving revision 1.267
> diff -c -r1.267 builtins.h
> *** src/include/utils/builtins.h 18 Oct 2005 20:38:58 -0000 1.267
> --- src/include/utils/builtins.h 24 Oct 2005 20:55:58 -0000
> ***************
> *** 530,535 ****
> --- 530,536 ----
> extern Datum tidrecv(PG_FUNCTION_ARGS);
> extern Datum tidsend(PG_FUNCTION_ARGS);
> extern Datum tideq(PG_FUNCTION_ARGS);
> + extern Datum tidne(PG_FUNCTION_ARGS);
> extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
> extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
>
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
> retrieving revision 1.387
> diff -c -r1.387 pg_proc.h
> *** src/include/catalog/pg_proc.h 15 Oct 2005 02:49:42 -0000 1.387
> --- src/include/catalog/pg_proc.h 24 Oct 2005 20:56:01 -0000
> ***************
> *** 1625,1637 ****
> DATA(insert OID = 1291 ( array_length_coerce PGNSP PGUID 12 f f t f s 3 2277 "2277 23 16" _null_ _null_ _null_
array_length_coerce- _null_ ));
> DESCR("adjust any array to new element typmod");
>
> - DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
> - DESCR("equal");
> - DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
> - DESCR("latest tid of a tuple");
> - DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
> - DESCR("latest tid of a tuple");
> -
> DATA(insert OID = 2168 ( pg_database_size PGNSP PGUID 12 f f t f v 1 20 "19" _null_ _null_ _null_
pg_database_size_name- _null_ ));
> DESCR("Calculate total disk space usage for the specified database");
>
> --- 1625,1630 ----
> ***************
> *** 3765,3770 ****
> --- 3758,3772 ----
> DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 f f t f i 1 2281 "2281" _null_ _null_ _null_
gist_circle_compress- _null_ ));
> DESCR("GiST support");
>
> + /* Tid functions */
> + DATA(insert OID = 2601 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
> + DESCR("equal");
> + DATA(insert OID = 2602 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
> + DESCR("latest tid of a tuple");
> + DATA(insert OID = 2603 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_
currtid_byrelname- _null_ ));
> + DESCR("latest tid of a tuple");
> + DATA(insert OID = 2604 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne -
_null_));
> + DESCR("not equal");
>
> /*
> * Symbolic values for provolatile column: these indicate whether the result
> Index: src/include/catalog/pg_operator.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
> retrieving revision 1.137
> diff -c -r1.137 pg_operator.h
> *** src/include/catalog/pg_operator.h 15 Oct 2005 02:49:42 -0000 1.137
> --- src/include/catalog/pg_operator.h 24 Oct 2005 20:56:02 -0000
> ***************
> *** 128,135 ****
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel
eqjoinsel));
> ! #define TIDEqualOperator 387
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
> --- 128,136 ----
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 390 ( "<>" PGNSP PGUID b f 27 27 16 390 0 0 0 0 0 tidne
neqselneqjoinsel ));
> ! DATA(insert OID = 391 ( "=" PGNSP PGUID b f 27 27 16 391 0 0 0 0 0 tideq eqsel
eqjoinsel));
> ! #define TIDEqualOperator 391
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > This has been saved for the 8.2 release: > http://momjian.postgresql.org/cgi-bin/pgpatches_hold Uh, why do we need this at all? "NOT (tid = tid)" covers the functionality already. I disagree strongly with renumbering existing hand-assigned OIDs for this. There's too much risk of breakage and no benefit. Also, you forgot to add the negator cross-links between the operators. regards, tom lane
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > This has been saved for the 8.2 release: > > http://momjian.postgresql.org/cgi-bin/pgpatches_hold > > Uh, why do we need this at all? "NOT (tid = tid)" covers the > functionality already. tid should be a fully functional type, at least for = and !=. > I disagree strongly with renumbering existing hand-assigned OIDs for > this. There's too much risk of breakage and no benefit. Agreed. > Also, you forgot to add the negator cross-links between the operators. OK. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian wrote: > Tom Lane wrote: > >>Bruce Momjian <pgman@candle.pha.pa.us> writes: >> >>>This has been saved for the 8.2 release: >>> http://momjian.postgresql.org/cgi-bin/pgpatches_hold >> >>Uh, why do we need this at all? "NOT (tid = tid)" covers the >>functionality already. > > > tid should be a fully functional type, at least for = and !=. > > >>I disagree strongly with renumbering existing hand-assigned OIDs for >>this. There's too much risk of breakage and no benefit. > > > Agreed. > > >>Also, you forgot to add the negator cross-links between the operators. > > > OK. > I'll redo the patch taking these points into account. Cheers Mark
This has been saved for the 8.2 release:
http://momjian.postgresql.org/cgi-bin/pgpatches_hold
---------------------------------------------------------------------------
Mark Kirkwood wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> >
> >>Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >>
> >>>This has been saved for the 8.2 release:
> >>> http://momjian.postgresql.org/cgi-bin/pgpatches_hold
> >>
> >>Uh, why do we need this at all? "NOT (tid = tid)" covers the
> >>functionality already.
> >
> >
> > tid should be a fully functional type, at least for = and !=.
> >
> >
> >>I disagree strongly with renumbering existing hand-assigned OIDs for
> >>this. There's too much risk of breakage and no benefit.
> >
> >
> > Agreed.
> >
> >
> >>Also, you forgot to add the negator cross-links between the operators.
> >
> >
> > OK.
> >
>
> New patch, with no OID renumbering, plus the negators are there now :-)
> Thanks for the critique guys!
>
> regards
>
> Mark
>
>
> Index: src/backend/utils/adt/tid.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v
> retrieving revision 1.49
> diff -c -r1.49 tid.c
> *** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
> --- src/backend/utils/adt/tid.c 26 Oct 2005 05:07:36 -0000
> ***************
> *** 174,180 ****
> arg1->ip_posid == arg2->ip_posid);
> }
>
> - #ifdef NOT_USED
> Datum
> tidne(PG_FUNCTION_ARGS)
> {
> --- 174,179 ----
> ***************
> *** 185,191 ****
> BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
> arg1->ip_posid != arg2->ip_posid);
> }
> - #endif
>
> /*
> * Functions to get latest tid of a specified tuple.
> --- 184,189 ----
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v
> retrieving revision 1.267
> diff -c -r1.267 builtins.h
> *** src/include/utils/builtins.h 18 Oct 2005 20:38:58 -0000 1.267
> --- src/include/utils/builtins.h 26 Oct 2005 05:07:37 -0000
> ***************
> *** 530,535 ****
> --- 530,536 ----
> extern Datum tidrecv(PG_FUNCTION_ARGS);
> extern Datum tidsend(PG_FUNCTION_ARGS);
> extern Datum tideq(PG_FUNCTION_ARGS);
> + extern Datum tidne(PG_FUNCTION_ARGS);
> extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
> extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
>
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
> retrieving revision 1.387
> diff -c -r1.387 pg_proc.h
> *** src/include/catalog/pg_proc.h 15 Oct 2005 02:49:42 -0000 1.387
> --- src/include/catalog/pg_proc.h 26 Oct 2005 05:07:40 -0000
> ***************
> *** 1625,1630 ****
> --- 1625,1632 ----
> DATA(insert OID = 1291 ( array_length_coerce PGNSP PGUID 12 f f t f s 3 2277 "2277 23 16" _null_ _null_ _null_
array_length_coerce- _null_ ));
> DESCR("adjust any array to new element typmod");
>
> + DATA(insert OID = 2601 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne -
_null_));
> + DESCR("not equal");
> DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
> DESCR("equal");
> DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
> Index: src/include/catalog/pg_operator.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
> retrieving revision 1.137
> diff -c -r1.137 pg_operator.h
> *** src/include/catalog/pg_operator.h 15 Oct 2005 02:49:42 -0000 1.137
> --- src/include/catalog/pg_operator.h 26 Oct 2005 05:07:41 -0000
> ***************
> *** 128,135 ****
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel
eqjoinsel));
> #define TIDEqualOperator 387
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
> --- 128,136 ----
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 390 0 0 0 0 tideq eqsel
eqjoinsel));
> #define TIDEqualOperator 387
> + DATA(insert OID = 390 ( "<>" PGNSP PGUID b f 27 27 16 390 387 0 0 0 0 tidne neqsel
neqjoinsel));
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Your patch has been added to the PostgreSQL unapplied patches list at:
http://momjian.postgresql.org/cgi-bin/pgpatches
It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.
---------------------------------------------------------------------------
Mark Kirkwood wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> >
> >>Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >>
> >>>This has been saved for the 8.2 release:
> >>> http://momjian.postgresql.org/cgi-bin/pgpatches_hold
> >>
> >>Uh, why do we need this at all? "NOT (tid = tid)" covers the
> >>functionality already.
> >
> >
> > tid should be a fully functional type, at least for = and !=.
> >
> >
> >>I disagree strongly with renumbering existing hand-assigned OIDs for
> >>this. There's too much risk of breakage and no benefit.
> >
> >
> > Agreed.
> >
> >
> >>Also, you forgot to add the negator cross-links between the operators.
> >
> >
> > OK.
> >
>
> New patch, with no OID renumbering, plus the negators are there now :-)
> Thanks for the critique guys!
>
> regards
>
> Mark
>
>
> Index: src/backend/utils/adt/tid.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/tid.c,v
> retrieving revision 1.49
> diff -c -r1.49 tid.c
> *** src/backend/utils/adt/tid.c 27 May 2005 00:57:49 -0000 1.49
> --- src/backend/utils/adt/tid.c 26 Oct 2005 05:07:36 -0000
> ***************
> *** 174,180 ****
> arg1->ip_posid == arg2->ip_posid);
> }
>
> - #ifdef NOT_USED
> Datum
> tidne(PG_FUNCTION_ARGS)
> {
> --- 174,179 ----
> ***************
> *** 185,191 ****
> BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
> arg1->ip_posid != arg2->ip_posid);
> }
> - #endif
>
> /*
> * Functions to get latest tid of a specified tuple.
> --- 184,189 ----
> Index: src/include/utils/builtins.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v
> retrieving revision 1.267
> diff -c -r1.267 builtins.h
> *** src/include/utils/builtins.h 18 Oct 2005 20:38:58 -0000 1.267
> --- src/include/utils/builtins.h 26 Oct 2005 05:07:37 -0000
> ***************
> *** 530,535 ****
> --- 530,536 ----
> extern Datum tidrecv(PG_FUNCTION_ARGS);
> extern Datum tidsend(PG_FUNCTION_ARGS);
> extern Datum tideq(PG_FUNCTION_ARGS);
> + extern Datum tidne(PG_FUNCTION_ARGS);
> extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
> extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
>
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v
> retrieving revision 1.387
> diff -c -r1.387 pg_proc.h
> *** src/include/catalog/pg_proc.h 15 Oct 2005 02:49:42 -0000 1.387
> --- src/include/catalog/pg_proc.h 26 Oct 2005 05:07:40 -0000
> ***************
> *** 1625,1630 ****
> --- 1625,1632 ----
> DATA(insert OID = 1291 ( array_length_coerce PGNSP PGUID 12 f f t f s 3 2277 "2277 23 16" _null_ _null_ _null_
array_length_coerce- _null_ ));
> DESCR("adjust any array to new element typmod");
>
> + DATA(insert OID = 2601 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne -
_null_));
> + DESCR("not equal");
> DATA(insert OID = 1292 ( tideq PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tideq -
_null_));
> DESCR("equal");
> DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null_ _null_ _null_
currtid_byreloid- _null_ ));
> Index: src/include/catalog/pg_operator.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_operator.h,v
> retrieving revision 1.137
> diff -c -r1.137 pg_operator.h
> *** src/include/catalog/pg_operator.h 15 Oct 2005 02:49:42 -0000 1.137
> --- src/include/catalog/pg_operator.h 26 Oct 2005 05:07:41 -0000
> ***************
> *** 128,135 ****
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel
eqjoinsel));
> #define TIDEqualOperator 387
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
> --- 128,136 ----
> DATA(insert OID = 389 ( "!!" PGNSP PGUID l f 0 20 1700 0 0 0 0 0 0 numeric_fac - - ));
> DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cideq eqsel
eqjoinsel));
> DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq
eqseleqjoinsel ));
> ! DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 390 0 0 0 0 tideq eqsel
eqjoinsel));
> #define TIDEqualOperator 387
> + DATA(insert OID = 390 ( "<>" PGNSP PGUID b f 27 27 16 390 387 0 0 0 0 tidne neqsel
neqjoinsel));
>
> DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel
eqjoinsel));
> DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
>
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
On Wed, 2006-06-14 at 18:08 -0400, Bruce Momjian wrote: > Your patch has been added to the PostgreSQL unapplied patches list at: > > http://momjian.postgresql.org/cgi-bin/pgpatches > > It will be applied as soon as one of the PostgreSQL committers reviews > and approves it. I applied a variant of this patch a few months ago. -Neil
Neil Conway wrote: > On Wed, 2006-06-14 at 18:08 -0400, Bruce Momjian wrote: > > Your patch has been added to the PostgreSQL unapplied patches list at: > > > > http://momjian.postgresql.org/cgi-bin/pgpatches > > > > It will be applied as soon as one of the PostgreSQL committers reviews > > and approves it. > > I applied a variant of this patch a few months ago. Thanks. I remember now. -- Bruce Momjian http://candle.pha.pa.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +