postgresql 中的子句 'temp table' 与 'global temporary table' 有什么区别?
What is the difference between clauses 'temp table' vs 'global temporary table' in postgresql?
CREATE TEMP TABLE myTempTable
和 CREATE GLOBAL TEMPORARY TABLE myTempTable
有什么区别?
Postgres 没有区别。正如 documentation 解释的那样:
The SQL standard also distinguishes between global and local temporary tables, where a local temporary table has a separate set of contents for each SQL module within each session, though its definition is still shared across sessions. Since PostgreSQL does not support SQL modules, this distinction is not relevant in PostgreSQL.
For compatibility's sake, PostgreSQL will accept the GLOBAL and LOCAL keywords in a temporary table declaration, but they currently have no effect. Use of these keywords is discouraged, since future versions of PostgreSQL might adopt a more standard-compliant interpretation of their meaning.
我添加了突出显示。
CREATE TEMP TABLE myTempTable
和 CREATE GLOBAL TEMPORARY TABLE myTempTable
有什么区别?
Postgres 没有区别。正如 documentation 解释的那样:
The SQL standard also distinguishes between global and local temporary tables, where a local temporary table has a separate set of contents for each SQL module within each session, though its definition is still shared across sessions. Since PostgreSQL does not support SQL modules, this distinction is not relevant in PostgreSQL.
For compatibility's sake, PostgreSQL will accept the GLOBAL and LOCAL keywords in a temporary table declaration, but they currently have no effect. Use of these keywords is discouraged, since future versions of PostgreSQL might adopt a more standard-compliant interpretation of their meaning.
我添加了突出显示。