dbTalk Databases Forums  

Re: Global temporary tables surprise

comp.databases.postgresql comp.databases.postgresql


Discuss Re: Global temporary tables surprise in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: Global temporary tables surprise - 06-13-2010 , 08:09 AM






On 2010-06-13 10:54, Mladen Gogala wrote:
[...]
Quote:
So, Postgresql will simply ignore "GLOBAL" or "LOCAL" and will create a
local temporary table anyway? Why is that? Don't get me wrong, local
temporary tables are a great replacement for cursors, but global
temporary tables have their uses too. Is there any hope that we will have
global temporary tables in the foreseeable future? Another popular
variety of databases supports global temporary tables but not local
temporary tables. It would be very nice to have a standard terminology,
wouldn't it?

I have very little experience with psql, but psql's behaviour seems
similar to other vendors in this regard. It is global, but only for the
current connection. From the IBM db2 9.5 manual:

http://publib.boulder.ibm.com/infoce.../r0003272.html

The DECLARE GLOBAL TEMPORARY TABLE statement defines a temporary table
for the current session.

This behaviour also seems in accordance with the 2008 draft version of
the sql standard (5CD2-02-Foundation-2006-01.pdf, page 54)

A global temporary table is a named table defined by a <table
definition> that specifies GLOBAL TEMPORARY.
A created local temporary table is a named table defined by a <table
definition> that specifies LOCAL TEM-
PORARY. Global and created local temporary tables are effectively
materialized only when referenced in an
SQL-session. Every SQL-client module in every SQL-session that
references a created local temporary table
causes a distinct instance of that created local temporary table to be
materialized. That is, the contents of a
global temporary table or a created local temporary table cannot be
shared between SQL-sessions.

You can download draft versions of the standard from:

http://www.wiscorp.com/SQLStandards.html


/Lennart

Reply With Quote
  #2  
Old   
Matthew Woodcraft
 
Posts: n/a

Default Re: Global temporary tables surprise - 06-13-2010 , 08:21 AM






Mladen Gogala <gogala.mladen (AT) gmail (DOT) com> wrote:
Quote:
So, Postgresql will simply ignore "GLOBAL" or "LOCAL" and will create a
local temporary table anyway? Why is that? Don't get me wrong, local
temporary tables are a great replacement for cursors, but global
temporary tables have their uses too. Is there any hope that we will have
global temporary tables in the foreseeable future? Another popular
variety of databases supports global temporary tables but not local
temporary tables. It would be very nice to have a standard terminology,
wouldn't it?
See
http://archives.postgresql.org/pgsql...4/msg01098.php
for recent discussion on psql-hackers.

-M-

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.