mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Make UNKNOWN into an actual pseudo-type.
Previously, type "unknown" was labeled as a base type in pg_type, which perhaps had some sense to it because you were allowed to create tables with unknown-type columns. But now that we don't allow that, it makes more sense to label it a pseudo-type. This has the additional effects of forbidding use of "unknown" as a domain base type, cast source or target type, PL function argument or result type, or plpgsql local variable type; all of which seem like good holes to plug. Discussion: https://postgr.es/m/CAH2L28uwwbL9HUM-WR=hromW1Cvamkn7O-g8fPY2m=_7muJ0oA@mail.gmail.com
This commit is contained in:
@ -490,8 +490,7 @@ CheckAttributeType(const char *attname,
|
||||
char att_typtype = get_typtype(atttypid);
|
||||
Oid att_typelem;
|
||||
|
||||
if (atttypid == UNKNOWNOID ||
|
||||
att_typtype == TYPTYPE_PSEUDO)
|
||||
if (att_typtype == TYPTYPE_PSEUDO)
|
||||
{
|
||||
/*
|
||||
* Refuse any attempt to create a pseudo-type column, except for a
|
||||
|
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201701201
|
||||
#define CATALOG_VERSION_NO 201701251
|
||||
|
||||
#endif
|
||||
|
@ -418,7 +418,7 @@ DESCR("relative, limited-range time interval (Unix delta time)");
|
||||
DATA(insert OID = 704 ( tinterval PGNSP PGUID 12 f b T f t \054 0 0 1025 tintervalin tintervalout tintervalrecv tintervalsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
|
||||
DESCR("(abstime,abstime), time interval");
|
||||
#define TINTERVALOID 704
|
||||
DATA(insert OID = 705 ( unknown PGNSP PGUID -2 f b X f t \054 0 0 0 unknownin unknownout unknownrecv unknownsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
|
||||
DATA(insert OID = 705 ( unknown PGNSP PGUID -2 f p X f t \054 0 0 0 unknownin unknownout unknownrecv unknownsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
|
||||
DESCR("");
|
||||
#define UNKNOWNOID 705
|
||||
|
||||
|
@ -59,7 +59,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR
|
||||
-- Look for types that should have an array type according to their typtype,
|
||||
-- but don't. We exclude composites here because we have not bothered to
|
||||
-- make array types corresponding to the system catalogs' rowtypes.
|
||||
-- NOTE: as of 9.1, this check finds pg_node_tree, smgr, and unknown.
|
||||
-- NOTE: as of v10, this check finds pg_node_tree and smgr.
|
||||
SELECT p1.oid, p1.typname
|
||||
FROM pg_type as p1
|
||||
WHERE p1.typtype not in ('c','d','p') AND p1.typname NOT LIKE E'\\_%'
|
||||
@ -71,8 +71,7 @@ WHERE p1.typtype not in ('c','d','p') AND p1.typname NOT LIKE E'\\_%'
|
||||
-----+--------------
|
||||
194 | pg_node_tree
|
||||
210 | smgr
|
||||
705 | unknown
|
||||
(3 rows)
|
||||
(2 rows)
|
||||
|
||||
-- Make sure typarray points to a varlena array type of our own base
|
||||
SELECT p1.oid, p1.typname as basetype, p2.typname as arraytype,
|
||||
|
@ -53,7 +53,7 @@ WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR
|
||||
-- Look for types that should have an array type according to their typtype,
|
||||
-- but don't. We exclude composites here because we have not bothered to
|
||||
-- make array types corresponding to the system catalogs' rowtypes.
|
||||
-- NOTE: as of 9.1, this check finds pg_node_tree, smgr, and unknown.
|
||||
-- NOTE: as of v10, this check finds pg_node_tree and smgr.
|
||||
|
||||
SELECT p1.oid, p1.typname
|
||||
FROM pg_type as p1
|
||||
|
Reference in New Issue
Block a user