diff options
author | Andres Freund <andres@anarazel.de> | 2017-01-26 16:47:03 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-01-26 16:47:03 -0800 |
commit | 9ba8a9ce4548bb34b7136b7463a61b2c499979a3 (patch) | |
tree | d11a07704ed51e833683b52131bcc4d5a37eaed3 /src/backend/commands/tablecmds.c | |
parent | 5bcab111426e5aae659a97a66d5de4ab9fe40edf (diff) |
Use the new castNode() macro in a number of places.
This is far from a pervasive conversion, but it's a good starting
point.
Author: Peter Eisentraut, with some minor changes by me
Reviewed-By: Tom Lane
Discussion: https://postgr.es/m/c5d387d9-3440-f5e0-f9d4-71d53b9fbe52@2ndquadrant.com
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c4b0011bdd6..04b5d9a943c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5932,12 +5932,11 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options, colName))); /* Generate new proposed attoptions (text array) */ - Assert(IsA(options, List)); datum = SysCacheGetAttr(ATTNAME, tuple, Anum_pg_attribute_attoptions, &isnull); newOptions = transformRelOptions(isnull ? (Datum) 0 : datum, - (List *) options, NULL, NULL, false, - isReset); + castNode(List, options), NULL, NULL, + false, isReset); /* Validate new options */ (void) attribute_reloptions(newOptions, true); @@ -7141,8 +7140,7 @@ ATExecAlterConstraint(Relation rel, AlterTableCmd *cmd, bool found = false; ObjectAddress address; - Assert(IsA(cmd->def, Constraint)); - cmdcon = (Constraint *) cmd->def; + cmdcon = castNode(Constraint, cmd->def); conrel = heap_open(ConstraintRelationId, RowExclusiveLock); @@ -9348,9 +9346,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId, char *cmd, IndexStmt *indstmt; Oid indoid; - Assert(IsA(cmd->def, IndexStmt)); - - indstmt = (IndexStmt *) cmd->def; + indstmt = castNode(IndexStmt, cmd->def); indoid = get_constraint_index(oldId); if (!rewrite) @@ -9373,9 +9369,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId, char *cmd, { Constraint *con; - Assert(IsA(cmd->def, Constraint)); - - con = (Constraint *) cmd->def; + con = castNode(Constraint, cmd->def); con->old_pktable_oid = refRelId; /* rewriting neither side of a FK */ if (con->contype == CONSTR_FOREIGN && |