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

2002-07-17 Thread Rajesh Kumar Mallah.
Thanks for your reply. Stephan. On Thursday 18 July 2002 12:01, you wrote: > On Thu, 18 Jul 2002, Rajesh Kumar Mallah. wrote: > > > 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...) w

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 rec

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] 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] [HACKERS] why is postgres estimating so badly?

2002-07-17 Thread Tom Lane
"Luis Alberto Amigo Navarro" <[EMAIL PROTECTED]> writes: > -> Seq Scan on part (cost=0.00..12399.00 rows=1 width=4) (actual >time=24.88..4076.81 rows=10856 loops=1) Seems like the major misestimation is above: the LIKE clause on part is estimated to select just one row, but it selects 10856 o

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

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] [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 > time=1233

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 (a

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] 297

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 t

[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 time=472520.

[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? http://archives.

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

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 s