mirror of https://github.com/citusdata/citus.git
Test
parent
580ab012bf
commit
c85a7cdd25
|
@ -962,6 +962,8 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
|
||||||
}
|
}
|
||||||
else if (alterTableType == AT_AddColumn)
|
else if (alterTableType == AT_AddColumn)
|
||||||
{
|
{
|
||||||
|
deparseAT = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: This code path is nothing beneficial since we do not
|
* TODO: This code path is nothing beneficial since we do not
|
||||||
* support ALTER TABLE %s ADD COLUMN %s [constraint] for foreign keys.
|
* support ALTER TABLE %s ADD COLUMN %s [constraint] for foreign keys.
|
||||||
|
@ -1010,7 +1012,6 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
|
||||||
|
|
||||||
if (contain_nextval_expression_walker(expr, NULL))
|
if (contain_nextval_expression_walker(expr, NULL))
|
||||||
{
|
{
|
||||||
deparseAT = true;
|
|
||||||
useInitialDDLCommandString = false;
|
useInitialDDLCommandString = false;
|
||||||
|
|
||||||
/* the new column definition will have no constraint */
|
/* the new column definition will have no constraint */
|
||||||
|
@ -1041,8 +1042,6 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
|
||||||
strcmp(typeName, "bigserial") == 0 ||
|
strcmp(typeName, "bigserial") == 0 ||
|
||||||
strcmp(typeName, "serial8") == 0)
|
strcmp(typeName, "serial8") == 0)
|
||||||
{
|
{
|
||||||
deparseAT = true;
|
|
||||||
|
|
||||||
ColumnDef *newColDef = copyObject(columnDefinition);
|
ColumnDef *newColDef = copyObject(columnDefinition);
|
||||||
newColDef->is_not_null = false;
|
newColDef->is_not_null = false;
|
||||||
|
|
||||||
|
|
|
@ -141,15 +141,6 @@ AppendAlterTableCmdAddColumn(StringInfo buf, AlterTableCmd *alterTableCmd)
|
||||||
|
|
||||||
ColumnDef *columnDefinition = (ColumnDef *) alterTableCmd->def;
|
ColumnDef *columnDefinition = (ColumnDef *) alterTableCmd->def;
|
||||||
|
|
||||||
/*
|
|
||||||
* the way we use the deparser now, constraints are always NULL
|
|
||||||
* adding this check for ColumnDef consistency
|
|
||||||
*/
|
|
||||||
if (columnDefinition->constraints != NULL)
|
|
||||||
{
|
|
||||||
ereport(ERROR, (errmsg("Constraints are not supported for AT_AddColumn")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columnDefinition->colname)
|
if (columnDefinition->colname)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "%s ", quote_identifier(columnDefinition->colname));
|
appendStringInfo(buf, "%s ", quote_identifier(columnDefinition->colname));
|
||||||
|
@ -166,12 +157,6 @@ AppendAlterTableCmdAddColumn(StringInfo buf, AlterTableCmd *alterTableCmd)
|
||||||
appendStringInfoString(buf, " NOT NULL");
|
appendStringInfoString(buf, " NOT NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* the way we use the deparser now, collation is never used
|
|
||||||
* since the data type of columns that use sequences for default
|
|
||||||
* are only int,smallint and bigint (never text, varchar, char)
|
|
||||||
* Adding this part only for ColumnDef consistency
|
|
||||||
*/
|
|
||||||
Oid collationOid = GetColumnDefCollation(NULL, columnDefinition, typeOid);
|
Oid collationOid = GetColumnDefCollation(NULL, columnDefinition, typeOid);
|
||||||
if (OidIsValid(collationOid))
|
if (OidIsValid(collationOid))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue