Re: [SQL] Way to stop recursion?

2004-11-26 Thread Jonathan Knopp
Pierre-Frédéric Caillaud wrote: - Change the name of your table to "hidden_table" - Create a view which is a duplicate of your table : CREATE VIEW visible_table AS SELECT * FROM hidden_table; -> Your application now accesses its data without realizing it goes through a view. Now create a rule on

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Pierre-Frédéric Caillaud
You have to do this with a trigger. The problem is that the rule is expanded inline like a macro, so you can't prevent the behaviour you're seeing. True, but you can get out of the hole in another way : - Change the name of your table to "hidden_table" - Create a view which is a duplicate of

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Jonathan Knopp
Tom Lane wrote: CREATE TABLE parent (id INT, cola CHAR(1), common CHAR(1)); CREATE TABLE child (id INT, parent_id INT, cola(1), common(1)); What I need, is when "common" is changed for a parent, then that new value is reflected in "common" for all the children, ie: ... Problem is, when "common" i

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Andrew Sullivan
On Fri, Nov 26, 2004 at 04:31:11PM -0500, Tom Lane wrote: > > Seems to me that your real problem is a bogus database layout. If there > should only be one "common" value for a parent and children, then only > store one value ... that is, "common" should exist only in the parent. Tom's answers al

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Andrew Sullivan
On Fri, Nov 26, 2004 at 01:03:38PM -0800, Jonathan Knopp wrote: > UPDATE rules work perfectly for what I need to do except I need them to > only run once, not try and recurse (which of course isn't allowedby > postgresql anyway). Triggers seem a less efficient way to do the same > thing, though

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Tom Lane
Jonathan Knopp <[EMAIL PROTECTED]> writes: > CREATE TABLE parent (id INT, cola CHAR(1), common CHAR(1)); > CREATE TABLE child (id INT, parent_id INT, cola(1), common(1)); > What I need, is when "common" is changed for a parent, then that new > value is reflected in "common" for all the children,

[SQL] Way to stop recursion?

2004-11-26 Thread Jonathan Knopp
Been banging my head against the wall for days and starting to think there is no way to do what I need. Hoping someone on here can prove me wrong. UPDATE rules work perfectly for what I need to do except I need them to only run once, not try and recurse (which of course isn't allowedby postgre

Re: [SQL] Type Inheritance

2004-11-26 Thread Tom Lane
"Andrew Thorley" <[EMAIL PROTECTED]> writes: > Does anyone know how to implement type inheritance in postgresql? in oracle > you just use the word UNDER in ur code i.e: > CREATE TYPE test2_UDT UNDER test1_UDT AS (abc INT); If you had said what this *does*, we might be better able to help. But ta

Re: [SQL] Querying a list field against another list

2004-11-26 Thread Bruno Wolff III
On Fri, Nov 26, 2004 at 16:17:57 +0200, Aarni Ruuhimäki <[EMAIL PROTECTED]> wrote: > Hi, > > I tried to mail this to the novice list I believe it was rejected: No you weren't. The mail server that is reporting that error is sending the response to the wrong place. It is supposed to be going to

[SQL] Querying a list field against another list

2004-11-26 Thread Aarni Ruuhimäki
Hi, I tried to mail this to the novice list I believe it was rejected: >> The original message was received at 2004-11-26 14:55:09 +0100 from postoffice.local [10.0.0.1]    - The following addresses had permanent fatal errors - <[EMAIL PROTECTED]>    -Transcript of session follows -

Re: [SQL] tutorials for complex.sql & complex.c

2004-11-26 Thread Richard Huxton
Andrew Thorley wrote: The examples in this section can be found in complex.sql and complex.c in the src/tutorial directory of the source distribution. See the README file in that directory for instructions about running the examples. im still unsure, where to look. can anyone solve my prob? In th

[SQL] tutorials for complex.sql & complex.c

2004-11-26 Thread Andrew Thorley
hi can anyone inform me where to get the postgreSQL complex.sql & complex.c tutorials from, cos i have no idea. in the 7.4.2-A4 doc it says: The examples in this section can be found in complex.sql and complex.c in the src/tutorial directory of the source distribution. See the README file in th