On Tue, Apr 24, 2012 at 11:55:15PM -0400, Noah Misch wrote: > Concerning everyone's favorite topic, how to name the new type of table, I > liked Tom's proposal[1] to make CREATE TEMP TABLE retain current behavior and > have CREATE GLOBAL TEMP TABLE and/or CREATE LOCAL TEMP TABLE request the new > SQL-standard variety. (I'd vote for using CREATE GLOBAL and retaining CREATE > LOCAL for future expansion.) As he mentions, to get there, we'd ideally start > by producing a warning instead of silently accepting GLOBAL as a noise word. > Should we put such a warning into 9.2?
Here is the change I'd make. Thanks, nm > [1] http://archives.postgresql.org/message-id/5422.1240936...@sss.pgh.pa.us
*** 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. This usage is ! deprecated and may specify standard-compliant behavior in the future. </para> <para> *** a/src/backend/parser/gram.y --- b/src/backend/parser/gram.y *************** *** 2512,2521 **** CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' */ 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; } ; --- 2512,2549 ---- */ OptTemp: TEMPORARY { $$ = RELPERSISTENCE_TEMP; } | TEMP { $$ = RELPERSISTENCE_TEMP; } ! | LOCAL TEMPORARY ! { ! ereport(WARNING, ! (errmsg("LOCAL is deprecated in temporary table creation"), ! errdetail("This may specify different semantics in future versions of PostgreSQL."), ! parser_errposition(@1))); ! $$ = RELPERSISTENCE_TEMP; ! } ! | LOCAL TEMP ! { ! ereport(WARNING, ! (errmsg("LOCAL is deprecated in temporary table creation"), ! errdetail("This may specify different semantics in future versions of PostgreSQL."), ! parser_errposition(@1))); ! $$ = RELPERSISTENCE_TEMP; ! } ! | GLOBAL TEMPORARY ! { ! ereport(WARNING, ! (errmsg("GLOBAL is deprecated in temporary table creation"), ! errdetail("This may specify different semantics in future versions of PostgreSQL."), ! parser_errposition(@1))); ! $$ = RELPERSISTENCE_TEMP; ! } ! | GLOBAL TEMP ! { ! ereport(WARNING, ! (errmsg("GLOBAL is deprecated in temporary table creation"), ! errdetail("This may specify different semantics in future versions of PostgreSQL."), ! parser_errposition(@1))); ! $$ = RELPERSISTENCE_TEMP; ! } | UNLOGGED { $$ = RELPERSISTENCE_UNLOGGED; } | /*EMPTY*/ { $$ = RELPERSISTENCE_PERMANENT; } ; *************** *** 8920,8940 **** OptTempTableName: --- 8948,8984 ---- } | LOCAL TEMPORARY opt_table qualified_name { + ereport(WARNING, + (errmsg("LOCAL is deprecated in temporary table creation"), + errdetail("This may specify different semantics in future versions of PostgreSQL."), + parser_errposition(@1))); $$ = $4; $$->relpersistence = RELPERSISTENCE_TEMP; } | LOCAL TEMP opt_table qualified_name { + ereport(WARNING, + (errmsg("LOCAL is deprecated in temporary table creation"), + errdetail("This may specify different semantics in future versions of PostgreSQL."), + parser_errposition(@1))); $$ = $4; $$->relpersistence = RELPERSISTENCE_TEMP; } | GLOBAL TEMPORARY opt_table qualified_name { + ereport(WARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + errdetail("This may specify different semantics in future versions of PostgreSQL."), + parser_errposition(@1))); $$ = $4; $$->relpersistence = RELPERSISTENCE_TEMP; } | GLOBAL TEMP opt_table qualified_name { + ereport(WARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + errdetail("This may specify different semantics in future versions of PostgreSQL."), + parser_errposition(@1))); $$ = $4; $$->relpersistence = RELPERSISTENCE_TEMP; }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers