On Sun, Sep 28, 2008 at 9:57 PM, Seb <[EMAIL PROTECTED]> wrote:
>> Well, I was able to get PostgreSQL Update-able views to work nearly as
>> well as the update-able queries did in Access.
> Would you mind sharing a sample schema?
I'll see what I can do. I did post some sample schema a while back
On Sun, 28 Sep 2008 21:43:49 -0700,
"Richard Broersma" <[EMAIL PROTECTED]> wrote:
[...]
> Well, I was able to get PostgreSQL Update-able views to work nearly as
> well as the update-able queries did in Access.
Would you mind sharing a sample schema?
> As a side note, you'll notice that MS-Acce
On Sun, Sep 28, 2008 at 5:31 PM, Seb <[EMAIL PROTECTED]> wrote:
> I've read this thread with great interest as I'm coming to PostgreSQL
> from the MS Access world of databases, where one can enter new data into
> queries/forms and tables get automatically updated/deleted/inserted into
> where expec
On Tue, 17 Jun 2008 12:46:27 -0700,
"Richard Broersma" <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 17, 2008 at 12:34 PM, Michael Shulman <[EMAIL PROTECTED]> wrote:
>> Would it be possible to actually do something like this in an update
>> rule? You couldn't write the "begin/commit", but it seems tha
On Tue, Jun 17, 2008 at 3:46 AM, Klint Gore <[EMAIL PROTECTED]> wrote:
> The only way I could find to make this work is to use a rule and wrap the
> inner "insert returning" in a function.
>
> create or replace function newperson (studentinfo) returns setof person as
> $$
> declare
> arec person%r
"Michael Shulman" <[EMAIL PROTECTED]> writes:
>> http://www.postgresql.org/docs/8.3/static/rules-triggers.html
>> says "a trigger that is fired on INSERT on a view can do the same as
>> a rule: put the data somewhere else and suppress the insert in the
>> view." So what do I need to do to make an
Thanks to everyone who responded to this thread; although I have not
gotten a complete solution I have learned a lot about how rules and
triggers work. One particular question that is still unanswered:
On Mon, Jun 16, 2008 at 9:49 PM, Michael Shulman <[EMAIL PROTECTED]> wrote:
> The Postgres manu
On Tue, Jun 17, 2008 at 10:15 AM, Michael Shulman <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> wrote:
>> CREATE RULE studentinro_insert AS ON INSERT TO studentinfo
>> DO INSTEAD
>> (
>> INSERT INTO person ...;
>> INSERT INTO student(person_id,...) VALUES
>> (currval('person_person_id_seq'),...)
Michael Shulman wrote:
On Tue, Jun 17, 2008 at 3:46 AM, Klint Gore <[EMAIL PROTECTED]> wrote:
The only way I could find to make this work is to use a rule and wrap the
inner "insert returning" in a function.
Thanks, this works! Although it feels like something of a hack;
shouldn't the
On Tue, Jun 17, 2008 at 12:34 PM, Michael Shulman <[EMAIL PROTECTED]> wrote:
> Would it be possible to actually do something like this in an update
> rule? You couldn't write the "begin/commit", but it seems that you
> wouldn't need to either, since the UPDATE command invoking the rule
> will be w
On Tue, Jun 17, 2008 at 11:50 AM, Richard Broersma
<[EMAIL PROTECTED]> wrote:
> While your individual update rules are firing for each of your tables
> from T1 thru T[n] to change your OLD row to NEW. Another client could
> also at the same time be updating any of the other tables before and
> aft
On Tue, Jun 17, 2008 at 8:34 AM, Michael Shulman <[EMAIL PROTECTED]> wrote:
> Thank you very much for pointing this out! I am somewhat disturbed by
> the example in that thread of a "partially executed update" resulting
> from the obvious way to write an update rule for a view. I guess I
> need
On Tue, Jun 17, 2008 at 12:24 AM, Richard Broersma
<[EMAIL PROTECTED]> wrote:
> Anyway, here is a link discussing a generalized vertical partitioned
> view. Perhaps it can give you some idea to get yourself rolling.
> http://archives.postgresql.org/pgsql-general/2006-12/msg01119.php
Thank you ver
On Tue, Jun 17, 2008 at 7:56 AM, Philippe Grégoire
<[EMAIL PROTECTED]> wrote:
> CREATE RULE studentinro_insert AS ON INSERT TO studentinfo
> DO INSTEAD
> (
> INSERT INTO person ...;
> INSERT INTO student(person_id,...) VALUES
> (currval('person_person_id_seq'),...);
> );
I initially thought of thi
On Tue, Jun 17, 2008 at 3:46 AM, Klint Gore <[EMAIL PROTECTED]> wrote:
> The only way I could find to make this work is to use a rule and wrap the
> inner "insert returning" in a function.
Thanks, this works! Although it feels like something of a hack;
shouldn't there be a more elegant solution?
Michael,
You can try the following:
CREATE RULE studentinro_insert AS ON INSERT TO studentinfo
DO INSTEAD
(
INSERT INTO person ...;
INSERT INTO student(person_id,...) VALUES
(currval('person_person_id_seq'),...);
);
The currval() function gives you the value of the sequence associated to
you
Michael Shulman wrote:
On Mon, Jun 16, 2008 at 10:03 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote:
I can write a trigger
function that does the right thing, with 'INSERT ... RETURNING
person_id INTO ...', but Postgres will not let me add an INSERT
trigger to a view; it says 'ERROR: "studentinf
On Mon, Jun 16, 2008 at 10:24 PM, Richard Broersma
<[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 8:32 PM, Michael Shiulman <[EMAIL PROTECTED]> wrote:
> Anyway, here is a link discussing a generalized vertical partitioned
> view. Perhaps it can give you some idea to get yourself rolling.
> h
On Mon, Jun 16, 2008 at 8:32 PM, Michael Shiulman <[EMAIL PROTECTED]> wrote:
> No, I don't think table inheritance will help. My actual situation is
> somewhat more complicated: the view takes data from more than two
> tables with a many-to-one rather than one-to-one relationship. For
> instance
On Mon, Jun 16, 2008 at 10:27 PM, Craig Ringer
<[EMAIL PROTECTED]> wrote:
>> I want to be able to do INSERTs on "studentinfo" and have rows created
>> in both "person" and "student". This requires first inserting into
>> "person", capturing the "person_id" of the resulting row, and using it
>> to
On Mon, Jun 16, 2008 at 10:03 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote:
>> I can write a trigger
>> function that does the right thing, with 'INSERT ... RETURNING
>> person_id INTO ...', but Postgres will not let me add an INSERT
>> trigger to a view; it says 'ERROR: "studentinfo" is not a table
Michael Shulman wrote:
I want to be able to do INSERTs on "studentinfo" and have rows created
in both "person" and "student". This requires first inserting into
"person", capturing the "person_id" of the resulting row, and using it
to insert into "student". This seems as though it must be a co
On Mon, Jun 16, 2008 at 8:49 PM, Michael Shulman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> This feels like a very basic question but I cannot figure it out.
> Suppose I have two tables and a view that combines their data:
>
> CREATE TABLE person
> (person_id SERIAL PRIMARY KEY,
> ...);
>
> CREATE TABL
Hi,
This feels like a very basic question but I cannot figure it out.
Suppose I have two tables and a view that combines their data:
CREATE TABLE person
(person_id SERIAL PRIMARY KEY,
...);
CREATE TABLE student
(student_id SERIAL PRIMARY KEY,
person_id INTEGER REFERENCES person,
...)
CR
24 matches
Mail list logo