temp-table-syntax-warning-v2.patch
text/plain
Filename: temp-table-syntax-warning-v2.patch
Type: text/plain
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v2
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/create_table.sgml | 4 | 0 |
| src/backend/parser/gram.y | 20 | 0 |
*** a/doc/src/sgml/ref/create_table.sgml
--- b/doc/src/sgml/ref/create_table.sgml
***************
*** 163,169 **** CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<para>
Optionally, <literal>GLOBAL</literal> or <literal>LOCAL</literal>
can be written before <literal>TEMPORARY</> or <literal>TEMP</>.
! This makes no difference in <productname>PostgreSQL</>, but see
<xref linkend="sql-createtable-compatibility"
endterm="sql-createtable-compatibility-title">.
</para>
--- 163,170 ----
<para>
Optionally, <literal>GLOBAL</literal> or <literal>LOCAL</literal>
can be written before <literal>TEMPORARY</> or <literal>TEMP</>.
! This presently makes no difference in <productname>PostgreSQL</>
! and is deprecated; see
<xref linkend="sql-createtable-compatibility"
endterm="sql-createtable-compatibility-title">.
</para>
***************
*** 1310,1316 **** CREATE TABLE employees OF employee_type (
<productname>PostgreSQL</productname> does not have.
For compatibility's sake, <productname>PostgreSQL</productname> will
accept the <literal>GLOBAL</literal> and <literal>LOCAL</literal> keywords
! in a temporary table declaration, but they have no effect.
</para>
<para>
--- 1311,1318 ----
<productname>PostgreSQL</productname> does not have.
For compatibility's sake, <productname>PostgreSQL</productname> will
accept the <literal>GLOBAL</literal> and <literal>LOCAL</literal> keywords
! in a temporary table declaration, but they have no effect. Use in new
! applications is discouraged.
</para>
<para>
*** a/src/backend/parser/gram.y
--- b/src/backend/parser/gram.y
***************
*** 2514,2521 **** OptTemp: TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
| TEMP { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMP { $$ = RELPERSISTENCE_TEMP; }
! | GLOBAL TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
! | GLOBAL TEMP { $$ = RELPERSISTENCE_TEMP; }
| UNLOGGED { $$ = RELPERSISTENCE_UNLOGGED; }
| /*EMPTY*/ { $$ = RELPERSISTENCE_PERMANENT; }
;
--- 2514,2533 ----
| TEMP { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMPORARY { $$ = RELPERSISTENCE_TEMP; }
| LOCAL TEMP { $$ = RELPERSISTENCE_TEMP; }
! | GLOBAL TEMPORARY
! {
! ereport(WARNING,
! (errmsg("GLOBAL is deprecated in temporary table creation"),
! parser_errposition(@1)));
! $$ = RELPERSISTENCE_TEMP;
! }
! | GLOBAL TEMP
! {
! ereport(WARNING,
! (errmsg("GLOBAL is deprecated in temporary table creation"),
! parser_errposition(@1)));
! $$ = RELPERSISTENCE_TEMP;
! }
| UNLOGGED { $$ = RELPERSISTENCE_UNLOGGED; }
| /*EMPTY*/ { $$ = RELPERSISTENCE_PERMANENT; }
;
***************
*** 8930,8940 **** OptTempTableName:
--- 8942,8958 ----
}
| GLOBAL TEMPORARY opt_table qualified_name
{
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
$$ = $4;
$$->relpersistence = RELPERSISTENCE_TEMP;
}
| GLOBAL TEMP opt_table qualified_name
{
+ ereport(WARNING,
+ (errmsg("GLOBAL is deprecated in temporary table creation"),
+ parser_errposition(@1)));
$$ = $4;
$$->relpersistence = RELPERSISTENCE_TEMP;
}