[SQL] trigger : emulate "instead of" with before ?

2003-06-13 Thread Albrecht Berger
Hello, I need a trigger which is updating a delete flag of a row instead of deleting it physically. How do I implement a trigger which doesn't execute a delete without raising an exception in plsql ? CREATE TRIGGER trigger1 BEFORE DELETE ON table1 FOR EACH ROW EXECUTE PROCEDURE setDeleteFlag ();

[SQL] Inheritance in SQL99 ?

2002-11-26 Thread Albrecht Berger
Hello, is the inheritance of tables specified in the SQL99 standard, or is this a postgresql "add-on" ? Does anybody know when the primary key bug, which is documented in the docs, of this feature will be fixed ? Thx berger ---(end of broadcast)-

[SQL] Chaning locale sorting order for statements

2002-11-16 Thread Albrecht Berger
Hello, is it possible to change the locale sorting order in statements ? I need this for a multilingual web application, where I'm not able to set the locale in the session or elsewhere. In Oracle I would use something like that : SELECT * FROM table1 ORDER BY NLSSORT(column1, 'NLS_SORT=FRENCH');

[SQL] replace null with 0 in subselect ?

2002-10-16 Thread Albrecht Berger
Hello, I have a statement like this : INSERT INTO tab1 (c1, c2, c3) VALUES (1,2, SELECT MAX(pos)+1 FROM tab2); This works fine if the subselect returns a value, but if it returns null there is a problem. In this case a 0 has to be inserted. Is there any pg function which solves this problem ? I

Re: [SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
but how do I know that "distinct on" doesn't cut off the row with max(val2) of that id that I need ? > see the yesterday's thread about DISTINCT ON (non-standard Postgres feature) > > > I have a problem, which I'm not able to solve with a simple query : > > > > I need a resultset with distinct i

[SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
Hello, I have a problem, which I'm not able to solve with a simple query : I need a resultset with distinct id's, but the max val2 of each id. I tried to group by id, but though I need the pk in my resultset I have to group it too, which "destroys" the group of val2. Can this be done without a h