Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 41cba49

Browse files
author
Neil Conway
committed
Implement the <> operator for the tid type. Original patch from Mark
Kirkwood, minor improvements by Neil Conway. The regression tests have been updated and the catversion has been bumped.
1 parent c5e0415 commit 41cba49

File tree

7 files changed

+41
-8
lines changed

7 files changed

+41
-8
lines changed

src/backend/utils/adt/tid.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.49 2005/05/27 00:57:49 neilc Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.50 2006/02/26 18:36:21 neilc Exp $
1212
*
1313
* NOTES
1414
* input routine largely stolen from boxin().
@@ -174,7 +174,6 @@ tideq(PG_FUNCTION_ARGS)
174174
arg1->ip_posid == arg2->ip_posid);
175175
}
176176

177-
#ifdef NOT_USED
178177
Datum
179178
tidne(PG_FUNCTION_ARGS)
180179
{
@@ -185,7 +184,6 @@ tidne(PG_FUNCTION_ARGS)
185184
BlockIdGetBlockNumber(&(arg2->ip_blkid)) ||
186185
arg1->ip_posid != arg2->ip_posid);
187186
}
188-
#endif
189187

190188
/*
191189
* Functions to get latest tid of a specified tuple.

src/include/catalog/catversion.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.315 2006/02/12 03:22:19 momjian Exp $
40+
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.316 2006/02/26 18:36:21 neilc Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200602112
56+
#define CATALOG_VERSION_NO 200602251
5757

5858
#endif

src/include/catalog/pg_operator.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.139 2006/02/11 03:32:39 momjian Exp $
11+
* $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.140 2006/02/26 18:36:21 neilc Exp $
1212
*
1313
* NOTES
1414
* the genbki.sh script reads this file and generates .bki
@@ -130,6 +130,7 @@ DATA(insert OID = 385 ( "=" PGNSP PGUID b t 29 29 16 385 0 0 0 0 0 cide
130130
DATA(insert OID = 386 ( "=" PGNSP PGUID b t 22 22 16 386 0 0 0 0 0 int2vectoreq eqsel eqjoinsel ));
131131
DATA(insert OID = 387 ( "=" PGNSP PGUID b f 27 27 16 387 0 0 0 0 0 tideq eqsel eqjoinsel ));
132132
#define TIDEqualOperator 387
133+
DATA(insert OID = 402 ( "<>" PGNSP PGUID b f 27 27 16 402 0 0 0 0 0 tidne neqsel neqjoinsel ));
133134

134135
DATA(insert OID = 410 ( "=" PGNSP PGUID b t 20 20 16 410 411 412 412 412 413 int8eq eqsel eqjoinsel ));
135136
DATA(insert OID = 411 ( "<>" PGNSP PGUID b f 20 20 16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));

src/include/catalog/pg_proc.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.397 2006/02/12 03:22:19 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.398 2006/02/26 18:36:21 neilc Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -1598,6 +1598,8 @@ DATA(insert OID = 1293 ( currtid PGNSP PGUID 12 f f t f v 2 27 "26 27" _null
15981598
DESCR("latest tid of a tuple");
15991599
DATA(insert OID = 1294 ( currtid2 PGNSP PGUID 12 f f t f v 2 27 "25 27" _null_ _null_ _null_ currtid_byrelname - _null_ ));
16001600
DESCR("latest tid of a tuple");
1601+
DATA(insert OID = 2398 ( tidne PGNSP PGUID 12 f f t f i 2 16 "27 27" _null_ _null_ _null_ tidne - _null_ ));
1602+
DESCR("not equal");
16011603

16021604
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_ ));
16031605
DESCR("Calculate total disk space usage for the specified database");

src/include/utils/builtins.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.273 2006/02/11 03:32:41 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.274 2006/02/26 18:36:22 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -531,6 +531,7 @@ extern Datum tidout(PG_FUNCTION_ARGS);
531531
extern Datum tidrecv(PG_FUNCTION_ARGS);
532532
extern Datum tidsend(PG_FUNCTION_ARGS);
533533
extern Datum tideq(PG_FUNCTION_ARGS);
534+
extern Datum tidne(PG_FUNCTION_ARGS);
534535
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
535536
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
536537

src/test/regress/expected/transactions.out

+25
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,28 @@ fetch from foo;
517517
(1 row)
518518

519519
abort;
520+
-- tests for the "tid" type
521+
SELECT '(3, 3)'::tid = '(3, 4)'::tid;
522+
?column?
523+
----------
524+
f
525+
(1 row)
526+
527+
SELECT '(3, 3)'::tid = '(3, 3)'::tid;
528+
?column?
529+
----------
530+
t
531+
(1 row)
532+
533+
SELECT '(3, 3)'::tid <> '(3, 3)'::tid;
534+
?column?
535+
----------
536+
f
537+
(1 row)
538+
539+
SELECT '(3, 3)'::tid <> '(3, 4)'::tid;
540+
?column?
541+
----------
542+
t
543+
(1 row)
544+

src/test/regress/sql/transactions.sql

+6
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,9 @@ rollback to x;
325325
fetch from foo;
326326

327327
abort;
328+
329+
-- tests for the "tid" type
330+
SELECT '(3, 3)'::tid = '(3, 4)'::tid;
331+
SELECT '(3, 3)'::tid = '(3, 3)'::tid;
332+
SELECT '(3, 3)'::tid <> '(3, 3)'::tid;
333+
SELECT '(3, 3)'::tid <> '(3, 4)'::tid;

0 commit comments

Comments
 (0)