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

Commit00c85b4

Browse files
committed
Allow comment-only lines, and ;;; lines too.
1 parentd71ef47 commit00c85b4

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

‎src/backend/parser/gram.y

Lines changed: 19 additions & 8 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 2.106 1999/10/03 23:55:30 tgl Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.107 1999/10/05 18:14:31 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -365,20 +365,29 @@ Oidparam_type(int t); /* used in parse_expr.c */
365365
%leftUNION INTERSECT EXCEPT
366366
%%
367367

368-
stmtblock: stmtmulti opt_semi
368+
/*
369+
*Handle comment-only lines, and ;; SELECT * FROM pg_class ;;;
370+
*psql already handles such cases, but other interfaces don't.
371+
*bjm 1999/10/05
372+
*/
373+
stmtblock: stmtmulti
369374
{ parsetree = $1; }
370375
;
371376

372377
stmtmulti: stmtmulti ';' stmt
373-
{ $$ = lappend($1, $3); }
378+
{ if ($3 != (Node *)NIL)
379+
$$ = lappend($1, $3);
380+
else
381+
$$ = $1;
382+
}
374383
| stmt
375-
{ $$ = lcons($1,NIL); }
384+
{ if ($1 != (Node *)NIL)
385+
$$ = lcons($1,NIL);
386+
else
387+
$$ = (Node *)NIL;
388+
}
376389
;
377390

378-
opt_semi:';'
379-
|/*EMPTY*/
380-
;
381-
382391
stmt : AddAttrStmt
383392
| AlterUserStmt
384393
| ClosePortalStmt
@@ -423,6 +432,8 @@ stmt : AddAttrStmt
423432
| VariableShowStmt
424433
| VariableResetStmt
425434
| ConstraintsSetStmt
435+
|/*EMPTY*/
436+
{ $$ = (Node *)NIL; }
426437
;
427438

428439
/*****************************************************************************

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp