Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c39f2f6

Browse files
committed
Fix publication syntax error message
There was some odd wording in corner-case gram.y error messages "some error ... at or near", which appears to have been modeled after "syntax error" messages. However, they don't work that way, and they're just wrong. They're also uncovered by tests. Remove the trailing words, and also add tests. They were introduced with 5a28324; backpatch to 15. Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
1 parent d8bcce1 commit c39f2f6

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/backend/parser/gram.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18832,7 +18832,7 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
1883218832
if (!pubobj->name && !pubobj->pubtable)
1883318833
ereport(ERROR,
1883418834
errcode(ERRCODE_SYNTAX_ERROR),
18835-
errmsg("invalid table name at or near"),
18835+
errmsg("invalid table name"),
1883618836
parser_errposition(pubobj->location));
1883718837

1883818838
if (pubobj->name)
@@ -18874,7 +18874,7 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
1887418874
else
1887518875
ereport(ERROR,
1887618876
errcode(ERRCODE_SYNTAX_ERROR),
18877-
errmsg("invalid schema name at or near"),
18877+
errmsg("invalid schema name"),
1887818878
parser_errposition(pubobj->location));
1887918879
}
1888018880

src/test/regress/expected/publication.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ Tables:
132132
Tables from schemas:
133133
"pub_test"
134134

135+
-- weird parser corner case
136+
CREATE PUBLICATION testpub_parsertst FOR TABLE pub_test.testpub_nopk, CURRENT_SCHEMA;
137+
ERROR: invalid table name
138+
LINE 1: ...estpub_parsertst FOR TABLE pub_test.testpub_nopk, CURRENT_SC...
139+
^
140+
CREATE PUBLICATION testpub_parsertst FOR TABLES IN SCHEMA foo, test.foo;
141+
ERROR: invalid schema name
142+
LINE 1: ...CATION testpub_parsertst FOR TABLES IN SCHEMA foo, test.foo;
143+
^
135144
-- should be able to add a table of the same schema to the schema publication
136145
ALTER PUBLICATION testpub_forschema ADD TABLE pub_test.testpub_nopk;
137146
\dRp+ testpub_forschema

src/test/regress/sql/publication.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ CREATE PUBLICATION testpub_for_tbl_schema FOR TABLES IN SCHEMA pub_test, TABLE p
7979
RESET client_min_messages;
8080
\dRp+ testpub_for_tbl_schema
8181

82+
-- weird parser corner case
83+
CREATE PUBLICATION testpub_parsertst FOR TABLE pub_test.testpub_nopk, CURRENT_SCHEMA;
84+
CREATE PUBLICATION testpub_parsertst FOR TABLES IN SCHEMA foo, test.foo;
85+
8286
-- should be able to add a table of the same schema to the schema publication
8387
ALTER PUBLICATION testpub_forschema ADD TABLE pub_test.testpub_nopk;
8488
\dRp+ testpub_forschema

0 commit comments

Comments
 (0)