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

Commit43163cf

Browse files
author
Thomas G. Lockhart
committed
Fix string conversions for operators in DEFAULT and CHECK clauses.
1 parent0829d2d commit43163cf

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

‎src/backend/parser/gram.y

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.45 1997/09/13 03:15:46 thomas Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.46 1997/09/16 16:11:20 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -419,27 +419,27 @@ default_expr: AexprConst
419419
| Pnull
420420
{$$ = lcons( makeString("NULL"), NIL); }
421421
| '-' default_expr %prec UMINUS
422-
{$$ = lcons( makeString( "-"), $2); }
422+
{$$ = lcons( makeString( "-"), $2); }
423423
| default_expr '+' default_expr
424-
{$$ = nconc( $1, lcons( makeString( "+"), $3)); }
424+
{$$ = nconc( $1, lcons( makeString( "+"), $3)); }
425425
| default_expr '-' default_expr
426-
{$$ = nconc( $1, lcons( makeString( "-"), $3)); }
426+
{$$ = nconc( $1, lcons( makeString( "-"), $3)); }
427427
| default_expr '/' default_expr
428-
{$$ = nconc( $1, lcons( makeString( "/"), $3)); }
428+
{$$ = nconc( $1, lcons( makeString( "/"), $3)); }
429429
| default_expr '*' default_expr
430-
{$$ = nconc( $1, lcons( makeString( "*"), $3)); }
430+
{$$ = nconc( $1, lcons( makeString( "*"), $3)); }
431431
| default_expr '=' default_expr
432-
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
432+
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
433433
| default_expr '<' default_expr
434-
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
434+
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
435435
| default_expr '>' default_expr
436-
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
436+
{elog(WARN,"boolean expressions not supported in DEFAULT",NULL); }
437437
| ':' default_expr
438-
{$$ = lcons( makeString( ":"), $2); }
438+
{$$ = lcons( makeString( ":"), $2); }
439439
| ';' default_expr
440-
{$$ = lcons( makeString( ";"), $2); }
440+
{$$ = lcons( makeString( ";"), $2); }
441441
| '|' default_expr
442-
{$$ = lcons( makeString( "|"), $2); }
442+
{$$ = lcons( makeString( "|"), $2); }
443443
| default_expr TYPECAST Typename
444444
{
445445
$$ = nconc( lcons( makeString( "CAST"), $1), makeList( makeString("AS"), $3, -1));
@@ -449,7 +449,7 @@ default_expr: AexprConst
449449
$$ = nconc( lcons( makeString( "CAST"), $2), makeList( makeString("AS"), $4, -1));
450450
}
451451
| '(' default_expr ')'
452-
{$$ = lappend( lcons( makeString( "("), $2), makeString( ")")); }
452+
{$$ = lappend( lcons( makeString( "("), $2), makeString( ")")); }
453453
| name '(' default_expr ')'
454454
{
455455
$$ = makeList( makeString($1), makeString("("), -1);
@@ -460,12 +460,12 @@ default_expr: AexprConst
460460
{
461461
if (!strcmp("<=", $2) || !strcmp(">=", $2))
462462
elog(WARN,"boolean expressions not supported in DEFAULT",NULL);
463-
$$ = nconc( $1, lcons($2, $3));
463+
$$ = nconc( $1, lcons(makeString( $2), $3));
464464
}
465465
| Op default_expr
466-
{$$ = lcons($1, $2); }
466+
{$$ = lcons(makeString( $1), $2); }
467467
| default_expr Op
468-
{$$ =lcons( $2, $1); }
468+
{$$ =lappend( $1, makeString( $2)); }
469469
;
470470

471471
opt_null: NOT PNULL{ $$ = TRUE; }
@@ -635,6 +635,9 @@ printf("in ConstraintDef\n");
635635
constr->type = CONSTR_CHECK;
636636
constr->name = NULL;
637637
constr->def = FlattenStringList($2);
638+
#ifdef PARSEDEBUG
639+
printf("ConstraintDef: string is %s\n", (char *) constr->def);
640+
#endif
638641
$$ = constr;
639642
}
640643
;
@@ -651,27 +654,27 @@ printf( "Id is %s\n", $1);
651654
$$ = lcons( makeString($1), NIL);
652655
}
653656
| '-' constraint_elem %prec UMINUS
654-
{$$ = lcons( makeString( "-"), $2); }
657+
{$$ = lcons( makeString( "-"), $2); }
655658
| constraint_elem '+' constraint_elem
656-
{$$ = nconc( $1, lcons( makeString( "+"), $3)); }
659+
{$$ = nconc( $1, lcons( makeString( "+"), $3)); }
657660
| constraint_elem '-' constraint_elem
658-
{$$ = nconc( $1, lcons( makeString( "-"), $3)); }
661+
{$$ = nconc( $1, lcons( makeString( "-"), $3)); }
659662
| constraint_elem '/' constraint_elem
660-
{$$ = nconc( $1, lcons( makeString( "/"), $3)); }
663+
{$$ = nconc( $1, lcons( makeString( "/"), $3)); }
661664
| constraint_elem '*' constraint_elem
662-
{$$ = nconc( $1, lcons( makeString( "*"), $3)); }
665+
{$$ = nconc( $1, lcons( makeString( "*"), $3)); }
663666
| constraint_elem '=' constraint_elem
664-
{$$ = nconc( $1, lcons( makeString( "="), $3)); }
667+
{$$ = nconc( $1, lcons( makeString( "="), $3)); }
665668
| constraint_elem '<' constraint_elem
666-
{$$ = nconc( $1, lcons( makeString( "<"), $3)); }
669+
{$$ = nconc( $1, lcons( makeString( "<"), $3)); }
667670
| constraint_elem '>' constraint_elem
668-
{$$ = nconc( $1, lcons( makeString( ">"), $3)); }
671+
{$$ = nconc( $1, lcons( makeString( ">"), $3)); }
669672
| ':' constraint_elem
670-
{$$ = lcons( makeString( ":"), $2); }
673+
{$$ = lcons( makeString( ":"), $2); }
671674
| ';' constraint_elem
672-
{$$ = lcons( makeString( ";"), $2); }
675+
{$$ = lcons( makeString( ";"), $2); }
673676
| '|' constraint_elem
674-
{$$ = lcons( makeString( "|"), $2); }
677+
{$$ = lcons( makeString( "|"), $2); }
675678
| constraint_elem TYPECAST Typename
676679
{
677680
$$ = nconc( lcons( makeString( "CAST"), $1), makeList( makeString("AS"), $3, -1));
@@ -681,23 +684,23 @@ printf( "Id is %s\n", $1);
681684
$$ = nconc( lcons( makeString( "CAST"), $2), makeList( makeString("AS"), $4, -1));
682685
}
683686
| '(' constraint_elem ')'
684-
{$$ = lappend( lcons( makeString( "("), $2), makeString( ")")); }
687+
{$$ = lappend( lcons( makeString( "("), $2), makeString( ")")); }
685688
| name '(' constraint_elem ')'
686689
{
687690
$$ = makeList( makeString($1), makeString("("), -1);
688691
$$ = nconc( $$, $3);
689692
$$ = lappend( $$, makeString(")"));
690693
}
691694
| constraint_elem Op constraint_elem
692-
{$$ = nconc( $1, lcons($2, $3)); }
695+
{$$ = nconc( $1, lcons(makeString( $2), $3)); }
693696
| constraint_elem AND constraint_elem
694-
{$$ = nconc( $1, lcons( makeString( "AND"), $3)); }
697+
{$$ = nconc( $1, lcons( makeString( "AND"), $3)); }
695698
| constraint_elem OR constraint_elem
696-
{$$ = nconc( $1, lcons( makeString( "OR"), $3)); }
699+
{$$ = nconc( $1, lcons( makeString( "OR"), $3)); }
697700
| Op constraint_elem
698-
{$$ = lcons($1, $2); }
701+
{$$ = lcons(makeString( $1), $2); }
699702
| constraint_elem Op
700-
{$$ =lcons( $2, $1); }
703+
{$$ =lappend( $1, makeString( $2)); }
701704
;
702705

703706

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp