Re: [SQL] Query runs very slowly in Postgres, but very fast in other DBMS

2005-04-12 Thread Andrus
kumnr NOT IN (SELECT dokumnr FROM dok); and DELETE statement DELETE FROM rid WHERE dokumnr NOT IN (SELECT dokumnr FROM dok); Andrus ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Query runs very slowly in Postgres, but very fast in other DBMS

2005-04-11 Thread Andrus Moor
by comparing bitmaps. Is it possible to speed up this query is Postgres ? How to force Postgres to use indexes for this query ? Andrus ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (s

Re: [SQL] Merging item codes using referential integrity

2005-04-10 Thread Andrus Moor
> Andrus Moor wrote: >> I have item table and a lot of child tables where the items are used. >> I want to merge two item codes into single item in all tables. >> It is not nice to write a lot of separate UPDATE statements for each >> table. >> So I want to util

[SQL] Merging item codes using referential integrity

2005-03-26 Thread Andrus Moor
rders VALUES ('2'); INSERT INTO invoices VALUES ('2'); BEGIN; -- Direct Postgres to update all child tables. This causes error. UPDATE parent SET code='1' WHERE code='2'; -- Remove duplicate row CREATE TABLE parent AS SELECT * FROM parent GRO

[SQL] How to make update statement to work

2005-03-26 Thread Andrus Moor
I want to nullify fields which does not exist in reference table. I tried UPDATE demo.toode SET "liik"=NULL,"grupp"=NULL WHERE ("grupp","liik") NOT IN (SELECT ("grupp", "liik") FROM "artliik") but this causes error: ERROR: operator d

[SQL] select a list of schema names

2005-03-26 Thread Andrus Moor
I want to implement a multi-company database where each schema represents different company. I created a number of schemas in a database. How to select a list of schema names which current user is authorized to access ? I want to get the list of companies to allow user pick the one. ---