From f213131f2024bcb85aea7d2a7dfadef6a0ee1b31 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 28 Sep 2006 20:51:43 +0000 Subject: Fix IS NULL and IS NOT NULL tests on row-valued expressions to conform to the SQL spec, viz IS NULL is true if all the row's fields are null, IS NOT NULL is true if all the row's fields are not null. The former coding got this right for a limited number of cases with IS NULL (ie, those where it could disassemble a ROW constructor at parse time), but was entirely wrong for IS NOT NULL. Per report from Teodor. I desisted from changing the behavior for arrays, since on closer inspection it's not clear that there's any support for that in the SQL spec. This probably needs more consideration. --- src/backend/utils/cache/lsyscache.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/cache') diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 769206e02c8..53e3a5bf552 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.136 2006/08/15 22:36:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.137 2006/09/28 20:51:42 tgl Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -1716,6 +1716,18 @@ get_typtype(Oid typid) return '\0'; } +/* + * type_is_rowtype + * + * Convenience function to determine whether a type OID represents + * a "rowtype" type --- either RECORD or a named composite type. + */ +bool +type_is_rowtype(Oid typid) +{ + return (typid == RECORDOID || get_typtype(typid) == 'c'); +} + /* * get_typ_typrelid * -- cgit v1.2.3