aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2015-04-22 16:23:02 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2015-04-22 16:23:02 -0300
commit50a16e30ebd76e70fc76abb2c8f0cd1e71deac41 (patch)
tree0479ebfb5f2c57cb47e6eeee457f58afcd9e327f /src/backend/commands/typecmds.c
parent450fa1b5ba0e986a20d8c017500c0c0bbf1e0b4b (diff)
downloadpostgresql-50a16e30ebd76e70fc76abb2c8f0cd1e71deac41.tar.gz
postgresql-50a16e30ebd76e70fc76abb2c8f0cd1e71deac41.zip
Use the right type OID after creating a shell type
Commit a2e35b53c39b2a neglected to update the type OID to use further down in DefineType when TypeShellMake was changed to return ObjectAddress instead of OID (it got it right in DefineRange, however.) This resulted in an internal error message being issued when looking up I/O functions. Author: Michael Paquier Also add Asserts() to a couple of other places to ensure that the type OID being used is as expected.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 907ba1100ac..7d8561022a5 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -215,6 +215,7 @@ DefineType(List *names, List *parameters)
if (!OidIsValid(typoid))
{
address = TypeShellMake(typeName, typeNamespace, GetUserId());
+ typoid = address.objectId;
/* Make new shell type visible for modification below */
CommandCounterIncrement();
@@ -628,6 +629,7 @@ DefineType(List *names, List *parameters)
0, /* Array Dimensions of typbasetype */
false, /* Type NOT NULL */
collation); /* type's collation */
+ Assert(typoid == address.objectId);
/*
* Create the array type that goes with it.
@@ -1505,7 +1507,7 @@ DefineRange(CreateRangeStmt *stmt)
0, /* Array dimensions of typbasetype */
false, /* Type NOT NULL */
InvalidOid); /* type's collation (ranges never have one) */
- typoid = address.objectId;
+ Assert(typoid == address.objectId);
/* Create the entry in pg_range */
RangeCreate(typoid, rangeSubtype, rangeCollation, rangeSubOpclass,