Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2028840

Browse files
committed
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 beendisabled because not completely debugged, I believe. My patches simply addsome checks here and there. To enable the new code you must add -DNULL_PATCHto 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>
1 parent83adddf commit2028840

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

‎src/backend/parser/analyze.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.1.1.1 1996/07/09 06:21:39 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.2 1996/07/19 07:24:06 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1313,6 +1313,11 @@ make_targetlist_expr(ParseState *pstate,
13131313
elog(WARN,"make_targetlist_expr: invalid use of NULL expression");
13141314

13151315
type_id=exprType(expr);
1316+
#ifdefNULL_PATCH
1317+
if (!type_id) {
1318+
type_len=0;
1319+
}else
1320+
#endif
13161321
type_len=tlen(get_id_type(type_id));
13171322

13181323
/* I have no idea what the following does! */

‎src/backend/parser/catalog_utils.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.2 1996/07/19 07:24:08 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -471,6 +471,11 @@ oper(char *op, int arg1, int arg2)
471471
CandidateListcandidates;
472472
intncandidates;
473473

474+
#ifdefNULL_PATCH
475+
if (!arg2)arg2=arg1;
476+
if (!arg1)arg1=arg2;
477+
#endif
478+
474479
if (!(tup=SearchSysCacheTuple(OPRNAME,
475480
PointerGetDatum(op),
476481
ObjectIdGetDatum(arg1),

‎src/backend/parser/parse_query.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.2 1996/07/19 07:24:09 scrappy Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -617,7 +617,11 @@ make_const(Value *value)
617617

618618
/* null const */
619619
con=makeConst(0,0, (Datum)NULL, TRUE,0, FALSE);
620+
#ifdefNULL_PATCH
621+
returncon;
622+
#else
620623
returnNULL/*con*/;
624+
#endif
621625
}
622626
}
623627

‎src/backend/parser/parser.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.2 1996/07/19 07:24:11 scrappy Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -302,6 +302,10 @@ parser_typecast2(Node *expr, int exprType, Type tp, int typlen)
302302
Assert(IsA(expr,Const));
303303

304304
switch (exprType) {
305+
#ifdefNULL_PATCH
306+
case0:/* NULL */
307+
break;
308+
#endif
305309
case23:/* int4 */
306310
const_string= (char*)palloc(256);
307311
string_palloced= true;
@@ -352,6 +356,18 @@ parser_typecast2(Node *expr, int exprType, Type tp, int typlen)
352356
elog(WARN,"unknown type%d ",exprType);
353357
}
354358

359+
#ifdefNULL_PATCH
360+
if (!exprType) {
361+
adt=makeConst((Oid)typeid(tp),
362+
(Size)0,
363+
(Datum)NULL,
364+
true,/* isnull */
365+
0/* was omitted */,
366+
0/* not a set */);
367+
return ((Node*)adt);
368+
}
369+
#endif
370+
355371
cp=instr2 (tp,const_string,typlen);
356372

357373

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp