[SQL] How to recognize trigger-inserted rows?

2004-10-27 Thread Jeff Boes
I have a table with an INSERT/UPDATE/DELETE statement trigger. The trigger's action is to insert "jobs" into a queue noting that the table has changed. A number of other tables have FK relationships with this table, and they have their own statement triggers that fire on DELETE. When I delete

Re: [SQL] How to re-sort a sorted query?

2004-10-27 Thread Yudie
> select * from > (select distinct on (storenumber), itemsku, storenumber,price >from storeproduct where itemsku='10001' >order by storenumber, price) ss > order by price; > > regards, tom lane Thanks tom, this is working. I never thought it could be done like this. yudie > > --

Re: [SQL] How do you compare (NULL) and (non-NULL)?

2004-10-27 Thread Bruno Wolff III
On Tue, Oct 26, 2004 at 16:23:20 -0400, Wei Weng <[EMAIL PROTECTED]> wrote: > In the following query > > SELECT Parent FROM Channels ORDER BY Parent ASC; > > If I have a couple of (NULL)s in the field [Parent], they will be listed at > the bottom of the query result. > > Is it because Postgre

Re: [SQL] RULE and default nextval() column

2004-10-27 Thread Stephan Szabo
On Wed, 27 Oct 2004, Dmitry P. Ovechkin wrote: > Hello. > I'mtrying to implement history tables using rules. > I have > test_table > -- > create sequence history_seq start 1; > create sequence test_sequence; > # source table > drop table test_table; > create table test_table ( > i integer

[SQL] RULE and default nextval() column

2004-10-27 Thread Dmitry P. Ovechkin
Hello. I'mtrying to implement history tables using rules. I have test_table -- create sequence history_seq start 1; create sequence test_sequence; # source table drop table test_table; create table test_table ( i integer default nextval('test_sequence'), c character(10) ); # history table c