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

Commit46e9709

Browse files
committed
Remove transformAlterTableStmt's kluge to replace ColumnDef.is_not_null
flags by separate AT_SetNotNull subcommands. That was always ugly andinefficient, and it's now clear that it was merely a partial workaroundfor the bug just identified in ATExecAddColumn. This is just codebeautification not a bug fix, so no back-patch.Brendan Jurd, with some trivial additional cleanup by me.
1 parentbb908d9 commit46e9709

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

‎src/backend/parser/parse_utilcmd.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
2020
* Portions Copyright (c) 1994, Regents of the University of California
2121
*
22-
*$PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.11 2008/03/25 22:42:43 tgl Exp $
22+
*$PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.12 2008/04/24 20:46:49 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -1718,49 +1718,30 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
17181718
{
17191719
ColumnDef*def= (ColumnDef*)cmd->def;
17201720

1721-
Assert(IsA(cmd->def,ColumnDef));
1722-
transformColumnDefinition(pstate,&cxt,
1723-
(ColumnDef*)cmd->def);
1721+
Assert(IsA(def,ColumnDef));
1722+
transformColumnDefinition(pstate,&cxt,def);
17241723

17251724
/*
17261725
* If the column has a non-null default, we can't skip
17271726
* validation of foreign keys.
17281727
*/
1729-
if (((ColumnDef*)cmd->def)->raw_default!=NULL)
1728+
if (def->raw_default!=NULL)
17301729
skipValidation= false;
17311730

1732-
newcmds=lappend(newcmds,cmd);
1733-
1734-
/*
1735-
* Convert an ADD COLUMN ... NOT NULL constraint to a
1736-
* separate command
1737-
*/
1738-
if (def->is_not_null)
1739-
{
1740-
/* Remove NOT NULL from AddColumn */
1741-
def->is_not_null= false;
1742-
1743-
/* Add as a separate AlterTableCmd */
1744-
newcmd=makeNode(AlterTableCmd);
1745-
newcmd->subtype=AT_SetNotNull;
1746-
newcmd->name=pstrdup(def->colname);
1747-
newcmds=lappend(newcmds,newcmd);
1748-
}
1749-
17501731
/*
17511732
* All constraints are processed in other ways. Remove the
17521733
* original list
17531734
*/
17541735
def->constraints=NIL;
17551736

1737+
newcmds=lappend(newcmds,cmd);
17561738
break;
17571739
}
17581740
caseAT_AddConstraint:
17591741

17601742
/*
17611743
* The original AddConstraint cmd node doesn't go to newcmds
17621744
*/
1763-
17641745
if (IsA(cmd->def,Constraint))
17651746
transformTableConstraint(pstate,&cxt,
17661747
(Constraint*)cmd->def);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp