Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8d32d9

Browse files
committed
Make UNKNOWN into an actual pseudo-type.
Previously, type "unknown" was labeled as a base type in pg_type, whichperhaps had some sense to it because you were allowed to create tables withunknown-type columns. But now that we don't allow that, it makes moresense to label it a pseudo-type. This has the additional effects offorbidding use of "unknown" as a domain base type, cast source or targettype, 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
1 parent1e7c4bb commitd8d32d9

File tree

12 files changed

+26
-17
lines changed

12 files changed

+26
-17
lines changed

‎doc/src/sgml/datatype.sgml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4660,6 +4660,10 @@ SELECT * FROM pg_attribute
46604660
<primary>internal</primary>
46614661
</indexterm>
46624662

4663+
<indexterm zone="datatype-pseudo">
4664+
<primary>unknown</primary>
4665+
</indexterm>
4666+
46634667
<indexterm zone="datatype-pseudo">
46644668
<primary>opaque</primary>
46654669
</indexterm>
@@ -4781,9 +4785,16 @@ SELECT * FROM pg_attribute
47814785
<entry>Indicates that a function returns no value.</entry>
47824786
</row>
47834787

4788+
<row>
4789+
<entry><type>unknown</></entry>
4790+
<entry>Identifies a not-yet-resolved type, e.g. of an undecorated
4791+
string literal.</entry>
4792+
</row>
4793+
47844794
<row>
47854795
<entry><type>opaque</></entry>
4786-
<entry>An obsolete type name that formerly served all the above purposes.</entry>
4796+
<entry>An obsolete type name that formerly served many of the above
4797+
purposes.</entry>
47874798
</row>
47884799
</tbody>
47894800
</tgroup>

‎doc/src/sgml/ddl.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2579,7 +2579,7 @@ WHERE c.altitude &gt; 500 AND c.tableoid = p.oid;
25792579

25802580
<para>
25812581
Another way to get the same effect is to use the <type>regclass</>
2582-
pseudo-type, which will print the table OID symbolically:
2582+
aliastype, which will print the table OID symbolically:
25832583

25842584
<programlisting>
25852585
SELECT c.tableoid::regclass, c.name, c.altitude

‎doc/src/sgml/plhandler.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
language such as C, using the version-1 interface, and registered
2727
with <productname>PostgreSQL</productname> as taking no arguments
2828
and returning the type <type>language_handler</type>. This
29-
specialpseudotype identifies the function as a call handler and
29+
specialpseudo-type identifies the function as a call handler and
3030
prevents it from being called directly in SQL commands.
3131
For more details on C language calling conventions and dynamic loading,
3232
see <xref linkend="xfunc-c">.

‎doc/src/sgml/protocol.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
number of parameter symbols (<literal>$</><replaceable>n</>)
669669
used in the query string. Another special case is that a parameter's
670670
type can be specified as <type>void</> (that is, the OID of the
671-
<type>void</>pseudotype). This is meant to allow parameter symbols
671+
<type>void</>pseudo-type). This is meant to allow parameter symbols
672672
to be used for function parameters that are actually OUT parameters.
673673
Ordinarily there is no context in which a <type>void</> parameter
674674
could be used, but if such a parameter symbol appears in a function's

‎doc/src/sgml/queries.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ SELECT * FROM vw_getfoo;
762762
In some cases it is useful to define table functions that can
763763
return different column sets depending on how they are invoked.
764764
To support this, the table function can be declared as returning
765-
thepseudotype <type>record</>. When such a function is used in
765+
thepseudo-type <type>record</>. When such a function is used in
766766
a query, the expected row structure must be specified in the
767767
query itself, so that the system can know how to parse and plan
768768
the query. This syntax looks like:

‎doc/src/sgml/ref/create_function.sgml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ CREATE [ OR REPLACE ] FUNCTION
160160
</para>
161161
<para>
162162
Depending on the implementation language it might also be allowed
163-
to specify <quote>pseudotypes</> such as <type>cstring</>.
164-
Pseudotypes indicate that the actual argument type is either
163+
to specify <quote>pseudo-types</> such as <type>cstring</>.
164+
Pseudo-types indicate that the actual argument type is either
165165
incompletely specified, or outside the set of ordinary SQL data types.
166166
</para>
167167
<para>
@@ -199,7 +199,7 @@ CREATE [ OR REPLACE ] FUNCTION
199199
can be a base, composite, or domain type,
200200
or can reference the type of a table column.
201201
Depending on the implementation language it might also be allowed
202-
to specify <quote>pseudotypes</> such as <type>cstring</>.
202+
to specify <quote>pseudo-types</> such as <type>cstring</>.
203203
If the function is not supposed to return a value, specify
204204
<type>void</> as the return type.
205205
</para>

‎doc/src/sgml/ref/create_type.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ CREATE TYPE <replaceable class="parameter">name</replaceable>
824824
In <productname>PostgreSQL</productname> versions before 7.3, it
825825
was customary to avoid creating a shell type at all, by replacing the
826826
functions' forward references to the type name with the placeholder
827-
pseudotype <type>opaque</>. The <type>cstring</> arguments and
827+
pseudo-type <type>opaque</>. The <type>cstring</> arguments and
828828
results also had to be declared as <type>opaque</> before 7.3. To
829829
support loading of old dump files, <command>CREATE TYPE</> will
830830
accept I/O functions declared using <type>opaque</>, but it will issue

‎src/backend/catalog/heap.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ CheckAttributeType(const char *attname,
490490
charatt_typtype=get_typtype(atttypid);
491491
Oidatt_typelem;
492492

493-
if (atttypid==UNKNOWNOID||
494-
att_typtype==TYPTYPE_PSEUDO)
493+
if (att_typtype==TYPTYPE_PSEUDO)
495494
{
496495
/*
497496
* Refuse any attempt to create a pseudo-type column, except for a

‎src/include/catalog/catversion.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201701201
56+
#defineCATALOG_VERSION_NO201701251
5757

5858
#endif

‎src/include/catalog/pg_type.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ DESCR("relative, limited-range time interval (Unix delta time)");
418418
DATA(insertOID=704 (tintervalPGNSPPGUID12fbTft \054001025tintervalintintervalouttintervalrecvtintervalsend---ipf0-100_null__null__null_ ));
419419
DESCR("(abstime,abstime), time interval");
420420
#defineTINTERVALOID704
421-
DATA(insertOID=705 (unknownPGNSPPGUID-2fbXft \054000unknowninunknownoutunknownrecvunknownsend---cpf0-100_null__null__null_ ));
421+
DATA(insertOID=705 (unknownPGNSPPGUID-2fpXft \054000unknowninunknownoutunknownrecvunknownsend---cpf0-100_null__null__null_ ));
422422
DESCR("");
423423
#defineUNKNOWNOID705
424424

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp