Re: AW: [HACKERS] rules bug?

From: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
To: Andreas(dot)Zeugswetter(at)telecom(dot)at
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: AW: [HACKERS] rules bug?
Date: 1999-04-28 14:19:28
Message-ID: 199904281419.IAA27109@trillium.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> create rule surveys_ins as on insert to surveys
> do instead
> insert into survey_data (survey_date, name)
> select new.survey_date, new.name where not exists
> (select * from survey_data d where d.survey_date = new.survey_date
> and d.name = new.name);

The "problem" is visibility of data. The rows that have already been
inserted by this
same statement (insert ...select) are not visible to the restricting select.

Thanks for the clear explanation; it makes sense now. But ...

I really need a way to enter data into a table, then disperse it among
a bunch of others while maintaining all the correct relationships.
Rules seem perfect for this, except for this problem.

Is the only way to do this to convert the input table into a bunch of
individual INSERT commands (one per row)?

One way to do this is to use pg_dump to dump the data from the input
table, use a script to change target table, and reload the data.

Are there other better ways to do this? other workarounds?

Thanks again for your help.

Cheers,
Brook

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brook Milligan 1999-04-28 15:38:52 rule bug again
Previous Message Tom Lane 1999-04-28 14:02:36 Re: [HACKERS] Issues with the latest 6.5 source