| 8971 | */ |
| 8972 | |
| 8973 | static void |
| 8974 | ATPrepDropNotNull(Relation rel, bool recurse, bool recursing) |
| 8975 | { |
| 8976 | /* |
| 8977 | * If the parent is a partitioned table, like check constraints, we do not |
| 8978 | * support removing the NOT NULL while partitions exist. |
| 8979 | */ |
| 8980 | if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) |
| 8981 | { |
| 8982 | PartitionDesc partdesc = RelationGetPartitionDesc(rel, true); |
| 8983 | |
| 8984 | Assert(partdesc != NULL); |
| 8985 | if (partdesc->nparts > 0 && !recurse && !recursing) |
| 8986 | ereport(ERROR, |
| 8987 | (errcode(ERRCODE_INVALID_TABLE_DEFINITION), |
| 8988 | errmsg("cannot remove constraint from only the partitioned table when partitions exist"), |
| 8989 | errhint("Do not specify the ONLY keyword."))); |
| 8990 | } |
| 8991 | } |
| 8992 | |
| 8993 | /* |
| 8994 | * Return the address of the modified column. If the column was already |
no test coverage detected