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

Commit86705aa

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 parent12a34f5 commit86705aa

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
@@ -165,6 +165,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
165165
Oidexisting_relid;
166166
ParseCallbackStatepcbstate;
167167
boollike_found= false;
168+
boolis_foreign_table=IsA(stmt,CreateForeignTableStmt);
168169

169170
/*
170171
* We must not scribble on the passed-in CreateStmt, so copy it. (This is
@@ -330,7 +331,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
330331
/*
331332
* Postprocess check constraints.
332333
*/
333-
transformCheckConstraints(&cxt, true);
334+
transformCheckConstraints(&cxt,!is_foreign_table ?true : false);
334335

335336
/*
336337
* Output results.
@@ -2129,9 +2130,9 @@ transformCheckConstraints(CreateStmtContext *cxt, bool skipValidation)
21292130
return;
21302131

21312132
/*
2132-
* If creating a new table, we can safely skip validation of check
2133-
* constraints, and nonetheless mark them valid. (This will override any
2134-
* user-supplied NOT VALID flag.)
2133+
* If creating a new table (but not a foreign table), we can safely skip
2134+
*validation of checkconstraints, and nonetheless mark them valid.
2135+
*(This will override anyuser-supplied NOT VALID flag.)
21352136
*/
21362137
if (skipValidation)
21372138
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp