temporay table : error is repeated.

From: Patrick Coulombe <pcoulombe(at)mediacces(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: temporay table : error is repeated.
Date: 2000-06-28 20:21:40
Message-ID: 395A5E54.331C2479@mediacces.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Let me try to explain why i want to use temporary tables, maybe you have
others solutions for me (it's call experience) :)

I use PHP to interact with postgres.

1) The "user" do is selection (form - checkbox).
2) Results.
3) Options : he can print it, save it, and make MODIFICATIONS.

That's the problem... modfications : I don't want to let the "user"
change my db, but just add, modify, erase his selection-result. So I'm
thinking about this : put the result of is selection in a temporary
table to let him add, modify and erase is result without affect the
original db.

What I don't understand is when the temporary table will drop? When you
do it in psql, no ploblem cause when you quit this utility he drop
automatically the db - right? How does it work when you query from a web
page in PHP?

After... The query can be as big as that (depends on selection of the
user) ie :

select distinct * from medias, contacts where medias.media_id =
contacts.media_id AND medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 1 AND contacts_titres.contact_id =
contacts.contact_id AND (contacts_titres.titre_id = 12) AND (type_id = 1
OR type_id = 2 OR type_id = 0) AND (langue_id = 1 OR langue_id = 2) AND
nation_id = 1 UNION select distinct * from medias, contacts where
medias.media_id = contacts.media_id AND medias_categories.media_id =
medias.media_id AND medias_categories.categorie_id = 3 AND
medias_regions.media_id = medias.media_id AND (medias_regions.region_id
= 11 OR medias_regions.region_id = 13 OR medias_regions.region_id = 6)
AND (type_id = 1 OR type_id = 2 OR type_id = 0) AND (langue_id = 1 OR
langue_id = 2) AND nation_id = 1 AND niveau_id = 1 UNION select distinct
* from medias, contacts where medias.media_id = contacts.media_id AND
medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 5 AND medias_regions.media_id =
medias.media_id AND (medias_regions.region_id = 6 OR
medias_regions.region_id = 7 OR medias_regions.region_id = 3) AND
(type_id = 1 OR type_id = 2 OR type_id = 0) AND (langue_id = 1 OR
langue_id = 2) AND nation_id = 1 AND (bulletin != 1 OR bulletin is null)
UNION select distinct * from medias, contacts where medias.media_id =
contacts.media_id AND medias_categories.media_id = medias.media_id AND
medias_categories.categorie_id = 6 AND contacts_secteurs.contact_id =
contacts.contact_id AND (contacts_secteurs.soussecteur_id = 9 OR
contacts_secteurs.soussecteur_id = 67 OR
contacts_secteurs.soussecteur_id = 74 OR
contacts_secteurs.soussecteur_id = 6) AND (type_id = 1 OR type_id = 2 OR
type_id = 0) AND (langue_id = 1 OR langue_id = 2) AND nation_id = 1

TEMPORARY table with UNION : problem or not???

Sorry for this long post... but it's the last option of my project!
Thank you for let me know what you thinking about that.
Sorry for my english, but I get better everyday.

Patrick

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-06-29 01:55:09 Re: Finding the names of inheriting classes
Previous Message Robert B. Easter 2000-06-28 20:12:38 Re: retrieving a serial number