mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Make partitions automatically inherit OIDs.
Previously, if the parent was specified as WITH OIDS, each child also had to be explicitly specified as WITH OIDS. Amit Langote, per a report from Simon Riggs. Some additional work on the documentation changes by me. Discussion: http://postgr.es/m/CANP8+jJBpWocfKrbJcaf3iBt9E3U=WPE_NC8YE6rye+YJ1sYnQ@mail.gmail.com
This commit is contained in:
@ -634,19 +634,14 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
|
||||
relkind == RELKIND_PARTITIONED_TABLE));
|
||||
descriptor->tdhasoid = (localHasOids || parentOidCount > 0);
|
||||
|
||||
if (stmt->partbound)
|
||||
{
|
||||
/* If the parent has OIDs, partitions must have them too. */
|
||||
if (parentOidCount > 0 && !localHasOids)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot create table without OIDs as partition of table with OIDs")));
|
||||
/* If the parent doesn't, partitions must not have them. */
|
||||
if (parentOidCount == 0 && localHasOids)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot create table with OIDs as partition of table without OIDs")));
|
||||
}
|
||||
/*
|
||||
* If a partitioned table doesn't have the system OID column, then none
|
||||
* of its partitions should have it.
|
||||
*/
|
||||
if (stmt->partbound && parentOidCount == 0 && localHasOids)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot create table with OIDs as partition of table without OIDs")));
|
||||
|
||||
/*
|
||||
* Find columns with default values and prepare for insertion of the
|
||||
|
Reference in New Issue
Block a user