Re: Temporary Views

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hannu Krosing <hannu(at)tm(dot)ee>, Rod Taylor <rbt(at)zort(dot)ca>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Temporary Views
Date: 2002-08-14 00:46:05
Message-ID: 200208140046.g7E0k5P18744@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


You want to hear something funny? When I see the standards quoted, I
jump to the end to find out what the person says it really means. I
find reading those standards painful. I am glad others are reading
them.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> SQL99 is pretty clear about temporary tables, at least.
>
> >From SQL99 4.16 'Tables' pp. 40,41
>
> ---
>
> 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
> TEMPORARY. 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.
>
> In addition, the contents of a created local temporary table cannot be
> shared between SQL-client modules of a single SQL-session. The definition
> of a global temporary table or a created local temporary table appears in
> a schema. In SQL language, the name and the scope of the name of a global
> temporary table or a created local temporary table are indistinguishable
> from those of a persistent base table. However, because global temporary
> table contents are distinct within SQL-sessions, and created local
> temporary tables are distinct within SQL-client modules within
> SQL-sessions, the effective <schema name> of the schema in which the
> global temporary table or the created local temporary table is
> instantiated is an implementation-dependent <schemaname> that may be
> thought of as having been effectively derived from the <schema name> of
> the schema in which the global temporary table or created local temporary
> table is defined and the implementation-dependent SQL-session identifier
> associated with the SQL-session.
>
> In addition, the effective <schema name> of the schema in which the
> created local temporary table is instantiated may be thought of as being
> further qualified by a unique implementation-dependent name associated
> with the SQL-client module in which the created local temporary table is
> referenced.
>
> ---
>
> So surely SQL sessions should not be able to see each other's temporary
> tables the the views dependent upon them.
>
> Gavin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-08-14 00:47:35 Re: OOP real life example (was Re: Why is MySQL more
Previous Message Rod Taylor 2002-08-14 00:42:01 Re: Possible enhancement : replace view ?