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

Commitf66b0ff

Browse files
committed
Allow plpgsql variables' default value expressions to reference
existing variables (such as function parameters). Per gripe fromDavid Fetter.
1 parent9114cb1 commitf66b0ff

File tree

1 file changed

+4
-47
lines changed

1 file changed

+4
-47
lines changed

‎src/pl/plpgsql/src/gram.y

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.49 2003/11/29 19:52:12 pgsql Exp $
7+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.50 2003/12/23 00:01:57 tgl Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -628,52 +628,9 @@ decl_defval: ';'
628628
{$$ =NULL; }
629629
|decl_defkey
630630
{
631-
inttok;
632-
intlno;
633-
PLpgSQL_dstring ds;
634-
PLpgSQL_expr*expr;
635-
636-
lno = plpgsql_scanner_lineno();
637-
expr = malloc(sizeof(PLpgSQL_expr));
638-
plpgsql_dstring_init(&ds);
639-
plpgsql_dstring_append(&ds,"SELECT");
640-
641-
expr->dtype = PLPGSQL_DTYPE_EXPR;
642-
expr->plan =NULL;
643-
expr->nparams =0;
644-
645-
tok =yylex();
646-
switch (tok)
647-
{
648-
case0:
649-
yyerror("unexpected end of function");
650-
case K_NULL:
651-
if (yylex() !=';')
652-
yyerror("expected\";\" after\"NULL\"");
653-
654-
free(expr);
655-
plpgsql_dstring_free(&ds);
656-
657-
$$ =NULL;
658-
break;
659-
660-
default:
661-
plpgsql_dstring_append(&ds, yytext);
662-
while ((tok =yylex()) !=';')
663-
{
664-
if (tok ==0)
665-
yyerror("unterminated default value");
666-
667-
if (plpgsql_SpaceScanned)
668-
plpgsql_dstring_append(&ds,"");
669-
plpgsql_dstring_append(&ds, yytext);
670-
}
671-
expr->query = strdup(plpgsql_dstring_get(&ds));
672-
plpgsql_dstring_free(&ds);
673-
674-
$$ = expr;
675-
break;
676-
}
631+
plpgsql_ns_setlocal(false);
632+
$$ = plpgsql_read_expression(';',";");
633+
plpgsql_ns_setlocal(true);
677634
}
678635
;
679636

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp