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

Commit1f220c3

Browse files
committed
Allow a foreign table CHECK constraint to be initially NOT VALID.
For a table, the constraint can be considered validated immediately,because the table must be empty. But for a foreign table this isnot necessarily the case.Fixes a bug in commitf27a6b1.Amit Langote, with some changes by me.Discussion:http://postgr.es/m/d2b7419f-4a71-cf86-cc99-bfd0f359a1ea@lab.ntt.co.jp
1 parent060393f commit1f220c3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎src/backend/parser/parse_utilcmd.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
156156
Oidexisting_relid;
157157
ParseCallbackStatepcbstate;
158158
boollike_found= false;
159+
boolis_foreign_table=IsA(stmt,CreateForeignTableStmt);
159160

160161
/*
161162
* We must not scribble on the passed-in CreateStmt, so copy it. (This is
@@ -312,7 +313,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
312313
/*
313314
* Postprocess check constraints.
314315
*/
315-
transformCheckConstraints(&cxt, true);
316+
transformCheckConstraints(&cxt,!is_foreign_table ?true : false);
316317

317318
/*
318319
* Output results.
@@ -1935,9 +1936,9 @@ transformCheckConstraints(CreateStmtContext *cxt, bool skipValidation)
19351936
return;
19361937

19371938
/*
1938-
* If creating a new table, we can safely skip validation of check
1939-
* constraints, and nonetheless mark them valid. (This will override any
1940-
* user-supplied NOT VALID flag.)
1939+
* If creating a new table (but not a foreign table), we can safely skip
1940+
*validation of checkconstraints, and nonetheless mark them valid.
1941+
*(This will override anyuser-supplied NOT VALID flag.)
19411942
*/
19421943
if (skipValidation)
19431944
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp