From: | Scott Frankel <leknarf(at)pacbell(dot)net> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: inherited table and rules |
Date: | 2005-03-23 05:59:23 |
Message-ID: | c411a105f26ead85cc0f4444acaa3837@pacbell.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Syntax troubles.
What is the proper syntax for using FROM ONLY table_name in an UPDATE
statement?
According to the docs, In a FROM clause, I should be able to use the
ONLY keyword
preceding the table name. This throws an error:
UPDATE FROM ONLY people SET color = 'cyan' WHERE usr_pkey = 1;
What is the proper syntax for specifying FROM ONLY in the inheritance
statement?
This also throws an error:
CREATE TABLE people_history (
hist_pkey SERIAL NOT NULL PRIMARY KEY,
hist_tstamp timestamp DEFAULT CURRENT_TIMESTAMP
) INHERITS ONLY (people);
What does GUC stand for? ;)
Thanks!
Scott
On Mar 22, 2005, at 6:55 PM, Stephan Szabo wrote:
>
> On Tue, 22 Mar 2005, Scott Frankel wrote:
>
>>
>> This is weird. I have two tables: one inherits from the other. And
>> I
>> have a
>> rule that populates the inherited table with changes from the first.
>> When I
>> update a row in the first table, I get an ever-larger number of rows
>> added to
>> both it and the inherited table. i.e.:
>>
>> update 1 yields 2 new rows
>> update 2 yields 6 new rows
>> update 3 yields 42 new rows
>> update 4 yields 1806 new rows
>>
>> I'm clearly doing something wrong ;)
>
> I think you need to be using ONLY (or changing the sql_inheritance GUC
> variable) in all the queries on people in order to not also be getting
> rows from people_history in the SELECT and UPDATE (and in fact changing
> the select and update statements to FROM ONLY people seems to work for
> me).
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-03-23 06:12:07 | Re: Move cursor |
Previous Message | Michael Fuhr | 2005-03-23 05:38:49 | Re: Help with transactions |