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

Commit4011f8c

Browse files
committed
Issue clearer notice when inherited merged columns are moved
CREATE TABLE INHERIT moves user-specified columns to the location of theinherited column.Report by Fatal Majid
1 parentc1008f0 commit4011f8c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,12 +1756,16 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
17561756
*/
17571757
if (inhSchema!=NIL)
17581758
{
1759+
intschema_attno=0;
1760+
17591761
foreach(entry,schema)
17601762
{
17611763
ColumnDef*newdef=lfirst(entry);
17621764
char*attributeName=newdef->colname;
17631765
intexist_attno;
17641766

1767+
schema_attno++;
1768+
17651769
/*
17661770
* Does it conflict with some previously inherited column?
17671771
*/
@@ -1780,9 +1784,14 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
17801784
* Yes, try to merge the two column definitions. They must
17811785
* have the same type, typmod, and collation.
17821786
*/
1783-
ereport(NOTICE,
1784-
(errmsg("merging column \"%s\" with inherited definition",
1785-
attributeName)));
1787+
if (exist_attno==schema_attno)
1788+
ereport(NOTICE,
1789+
(errmsg("merging column \"%s\" with inherited definition",
1790+
attributeName)));
1791+
else
1792+
ereport(NOTICE,
1793+
(errmsg("moving and merging column \"%s\" with inherited definition",attributeName),
1794+
errdetail("User-specified column moved to the position of the inherited column.")));
17861795
def= (ColumnDef*)list_nth(inhSchema,exist_attno-1);
17871796
typenameTypeIdAndMod(NULL,def->typeName,&defTypeId,&deftypmod);
17881797
typenameTypeIdAndMod(NULL,newdef->typeName,&newTypeId,&newtypmod);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp