diff options
author | Marc G. Fournier <scrappy@hub.org> | 1996-07-19 07:24:11 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1996-07-19 07:24:11 +0000 |
commit | 20288400f3ad4a29fe6fa4623c35314c0f8eee05 (patch) | |
tree | 5ccfb3b3d2b847fc30d39d9bd58b33ba195db55b /src/backend/parser/parser.c | |
parent | 83adddfcc35b407e3d025f02e7d0149e5e2b9a76 (diff) | |
download | postgresql-20288400f3ad4a29fe6fa4623c35314c0f8eee05.tar.gz postgresql-20288400f3ad4a29fe6fa4623c35314c0f8eee05.zip |
Fixes:
I have written some patches which add support for NULLs to Postgres95.
In fact support for NULLs was already present in postgres, but it had been
disabled because not completely debugged, I believe. My patches simply add
some checks here and there. To enable the new code you must add -DNULL_PATCH
to CFLAGS in Makefile.global. After recompiling you can do things like:
insert into a (x, y) values (1, NULL);
update a set x = NULL where x = 0;
You can't still use a "where x=NULL" clause, you must use ISNULL instead.
This could probably be an easy fix to do.
Submitted by: Massimo Dal Zotto <dz@cs.unitn.it>
Diffstat (limited to 'src/backend/parser/parser.c')
-rw-r--r-- | src/backend/parser/parser.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c index e0dae907588..752db2f1f67 100644 --- a/src/backend/parser/parser.c +++ b/src/backend/parser/parser.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.2 1996/07/19 07:24:11 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -302,6 +302,10 @@ parser_typecast2(Node *expr, int exprType, Type tp, int typlen) Assert(IsA(expr,Const)); switch (exprType) { +#ifdef NULL_PATCH + case 0: /* NULL */ + break; +#endif case 23: /* int4 */ const_string = (char *) palloc(256); string_palloced = true; @@ -352,6 +356,18 @@ parser_typecast2(Node *expr, int exprType, Type tp, int typlen) elog(WARN,"unknown type%d ",exprType); } +#ifdef NULL_PATCH + if (!exprType) { + adt = makeConst((Oid)typeid(tp), + (Size) 0, + (Datum) NULL, + true, /* isnull */ + 0 /* was omitted */, + 0 /* not a set */); + return ((Node*) adt); + } +#endif + cp = instr2 (tp, const_string, typlen); |