Re: [SQL] A SQL Training

2002-07-17 Thread Achilleus Mantzios
On Tue, 16 Jul 2002, Devrim GUNDUZ wrote: You need to identify your problem: preorder traversal on a tree using pointers for the fathers. Then you have to prove (or prove the opposite) that SQL alone is capable of expressing what you need. BTW, Nested Sets are only good for static databases.

Re: [SQL] Cascading deletions does not seem to work inside PL/PGSQL functions.

2002-07-17 Thread Rajesh Kumar Mallah.
On Tuesday 16 July 2002 21:41, you wrote: On Tue, 16 Jul 2002, Rajesh Kumar Mallah. wrote: Hi folks, This problem has been troubling me for quite sometime and I would be very thankful for your help. I have included the complete commented script to recreate the problem in question.

[SQL] Large objects and Meta Data

2002-07-17 Thread Dror Matalon
Hi, I'm handling large objects from JDBC in a servlet environment. Every time we create a lo we also create a row in the zp_file table that holds additional information about the file, as well as the oid of the large object: Column | Type | Modifiers

Re: datatype matrix (was: Re: [SQL] Sorry..)

2002-07-17 Thread Karel Zak
On Tue, Jul 16, 2002 at 12:37:04PM -0500, Kevin Brannen wrote: Josh Berkus wrote: Christopher, In the bad old days when we couldn't distinguish explicit from implicit cast functions, I was wary of adding new cast pathways. Too many implicit casts and you have no type system at all.

Re: [SQL] Indexing UNIONs

2002-07-17 Thread Richard Huxton
On Tuesday 16 Jul 2002 11:42 pm, Josh Berkus wrote: OK, I guess I'll have to get into detail: [detail on cases and trial-groups] Thus, I need to relate (in views and queries) each Event to the Union of Cases and Trial Groups. I just can't figure out how to do so without the database

[SQL] How to find out if an index is unique?

2002-07-17 Thread Dirk Lutzebaeck
Hello, is there a way to ask the system tables if a given index was created with the unique qualification? I don't want to insert data to try. Greetings, Dirk ---(end of broadcast)--- TIP 6: Have you searched our list archives?

[SQL] why is postgres estimating so badly?

2002-07-17 Thread Luis Alberto Amigo Navarro
I have a query and estimations and results donĀ“t look similar, here is explain analyze: NOTICE: QUERY PLAN: Sort (cost=12443.90..12443.90 rows=1 width=93) (actual time=505331.94..505332.67 rows=175 loops=1) - Aggregate (cost=12443.88..12443.89 rows=1 width=93) (actual

Re: [SQL] How to find out if an index is unique?

2002-07-17 Thread Achilleus Mantzios
On Wed, 17 Jul 2002, Dirk Lutzebaeck wrote: Yes. Select the oid from pg_class where relname is your index name. Then search in pg_index for column indisunique using the previous oid as indexrelid. Hello, is there a way to ask the system tables if a given index was created with the

Re: [SQL] Need help on a troublesome query plan

2002-07-17 Thread Alain Lavigne
Thanks that worked, but why does that happen or maybe you could point to the proper thread so I read up on it. Alain Lavigne - Data Administrator - ZAQ Interactive Solutions E-Mail: [EMAIL PROTECTED]

Re: [SQL] Indexing UNIONs

2002-07-17 Thread Bruno Wolff III
On Tue, Jul 16, 2002 at 15:42:23 -0700, Josh Berkus [EMAIL PROTECTED] wrote: Table events, the largest table in the database, contains event schedule listing with 11 attributes and one dependant table as well as recursive relationships between events. Each event record can be (and Must

Re: [SQL] [HACKERS] please help on query

2002-07-17 Thread Masaru Sugawara
On Tue, 16 Jul 2002 10:51:03 +0200 Luis Alberto Amigo Navarro [EMAIL PROTECTED] wrote: Aggregate (cost=1257368.92..1287375.04 rows=600122 width=12) (actual time=1236941.71..1454824.56 rows=62 loops=1) - Group (cost=1257368.92..1272371.98 rows=6001225 width=12) (actual

Re: [SQL] How to find out if an index is unique?

2002-07-17 Thread Rajesh Kumar Mallah.
perhaps This is more elegant has Tom has indicated : select pg_get_indexdef(oid) from pg_class where relname = 'email_bank_email'; pg_get_indexdef --- CREATE UNIQUE INDEX email_bank_email

Re: [SQL] Cascading deletions does not seem to work inside PL/PGSQL

2002-07-17 Thread Stephan Szabo
On Wed, 17 Jul 2002, Rajesh Kumar Mallah. wrote: On Tuesday 16 July 2002 21:41, you wrote: On Tue, 16 Jul 2002, Rajesh Kumar Mallah. wrote: Hi folks, This problem has been troubling me for quite sometime and I would be very thankful for your help. I have included the

Re: [SQL] Indexing UNIONs

2002-07-17 Thread Josh Berkus
Bruno, I think you might be able to do this using (one sided) outer joins of the event table to the Case and Trial Group tables. The join rules will need to work for exactly one of the two tables. You probably will want to use case statements in the select list to pick values from the

Re: [SQL] Indexing UNIONs

2002-07-17 Thread Bruno Wolff III
Just in case there was some misunderstanding of my suggestion here is what I had in mind. Your query: SELECT t1.id, t1.name, t1.abbreviation, t1.juris_id FROM t1 UNION ALL SELECT t2.id, t2.name, NULL, t2.juris_id FROM t2; My suggestion: SELECT t3.id, coalesce(t1.name, t2.name), t1.abbreviation,

Re: [SQL] Cascading deletions does not seem to work inside PL/PGSQL functions.

2002-07-17 Thread Rajesh Kumar Mallah.
what if i do not want to fire sperate delete SQLs for the slave tables ? Hi , what is mean is that I a have many tables(x,y,z...) which reference the master table (M). I want that the records from the tables (x,y,z ect) automatically get deleted in the function when i delete the