pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feednew rule syntax?
5+ messages / 5 participants
[nested] [flat]
* new rule syntax?
@ 2006-02-05 12:00 A. R. Van Hook <hook@lake-lotawana.mo.us>
2006-02-05 13:10 ` Re: new rule syntax? Milen A. Radev <milen@radev.net>
2006-02-05 13:17 ` Re: new rule syntax? A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-02-06 09:49 ` Re: new rule syntax? Richard Huxton <dev@archonet.com>
0 siblings, 3 replies; 5+ messages in thread
From: A. R. Van Hook @ 2006-02-05 12:00 UTC (permalink / raw)
To: pgsql-sql
I have two tables defined as:
checks
(ckid int NOT null PRIMARY KEY,
payto text,
notes text,
ckdate date,
printed int default 0,
tdate timestamp not null)
checkitems
(item int not null,
ckid int NOT null references checks,
itemtype int not null,
amt numeric(7,3),
primary key (item, ckid))
in previous versions (<8.1) the following rule declaration seemed to
work fine
create rule checks_d0 as
on delete to checks
do delete from checkitems
where ckid = checks.ckid;
in 8.1.2 I get
ERROR: missing FROM-clause entry from table "checks"
any idea?
--
Arthur R. Van Hook
Mayor
The City of Lake Lotawana
hook@lake-lotawana.mo.us
(816) 578-4704 - Home
(816) 578-4215 - City
(816) 564-0769 - Cell
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: new rule syntax?
2006-02-05 12:00 new rule syntax? A. R. Van Hook <hook@lake-lotawana.mo.us>
@ 2006-02-05 13:10 ` Milen A. Radev <milen@radev.net>
2006-02-05 16:20 ` Re: new rule syntax? Jim Buttafuoco <jim@contactbda.com>
2 siblings, 1 reply; 5+ messages in thread
From: Milen A. Radev @ 2006-02-05 13:10 UTC (permalink / raw)
To: pgsql-sql
A. R. Van Hook написа:
> I have two tables defined as:
> checks
> (ckid int NOT null PRIMARY KEY,
> payto text,
> notes text,
> ckdate date,
> printed int default 0,
> tdate timestamp not null)
> checkitems
> (item int not null,
> ckid int NOT null references checks,
> itemtype int not null,
> amt numeric(7,3),
> primary key (item, ckid))
>
> in previous versions (<8.1) the following rule declaration seemed to
> work fine
> create rule checks_d0 as
> on delete to checks
> do delete from checkitems
> where ckid = checks.ckid;
> in 8.1.2 I get
>
> ERROR: missing FROM-clause entry from table "checks"
>
> any idea?
May be you are bitten by the change of the default value of
"add_missing_from" setting
(http://www.postgresql.org/docs/8.1/static/runtime-config-compatible.html#RUNTIME-CONFIG-COMPATIBLE-V...).
--
Milen A. Radev
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: new rule syntax?
2006-02-05 12:00 new rule syntax? A. R. Van Hook <hook@lake-lotawana.mo.us>
2006-02-05 13:10 ` Re: new rule syntax? Milen A. Radev <milen@radev.net>
@ 2006-02-05 16:20 ` Jim Buttafuoco <jim@contactbda.com>
0 siblings, 0 replies; 5+ messages in thread
From: Jim Buttafuoco @ 2006-02-05 16:20 UTC (permalink / raw)
To: Milen A. Radev <milen@radev.net>; pgsql-sql
Try this rule instead
create rule checks_d0 as
on delete to checks
do delete from checkitems
where ckid = OLD.ckid;
---------- Original Message -----------
From: "Milen A. Radev" <milen@radev.net>
To: pgsql-sql@postgresql.org
Sent: Sun, 05 Feb 2006 15:10:23 +0200
Subject: Re: [SQL] new rule syntax?
[UTF-8?]> A. R. Van Hook написа:
> > I have two tables defined as:
> > checks
> > (ckid int NOT null PRIMARY KEY,
> > payto text,
> > notes text,
> > ckdate date,
> > printed int default 0,
> > tdate timestamp not null)
> > checkitems
> > (item int not null,
> > ckid int NOT null references checks,
> > itemtype int not null,
> > amt numeric(7,3),
> > primary key (item, ckid))
> >
> > in previous versions (<8.1) the following rule declaration seemed to
> > work fine
> > create rule checks_d0 as
> > on delete to checks
> > do delete from checkitems
> > where ckid = checks.ckid;
> > in 8.1.2 I get
> >
> > ERROR: missing FROM-clause entry from table "checks"
> >
> > any idea?
>
> May be you are bitten by the change of the default value of
> "add_missing_from" setting
> (http://www.postgresql.org/docs/8.1/static/runtime-config-compatible.html#RUNTIME-CONFIG-COMPATIBLE-V...).
>
> --
> Milen A. Radev
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
------- End of Original Message -------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: new rule syntax?
2006-02-05 12:00 new rule syntax? A. R. Van Hook <hook@lake-lotawana.mo.us>
@ 2006-02-05 13:17 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2 siblings, 0 replies; 5+ messages in thread
From: A. Kretschmer @ 2006-02-05 13:17 UTC (permalink / raw)
To: pgsql-sql
am 05.02.2006, um 6:00:18 -0600 mailte A. R. Van Hook folgendes:
> in previous versions (<8.1) the following rule declaration seemed to work
> fine
> create rule checks_d0 as
> on delete to checks
> do delete from checkitems
> where ckid = checks.ckid;
> in 8.1.2 I get
>
> ERROR: missing FROM-clause entry from table "checks"
*untested*:
create rule checks_d0 as
on delete to checks
do delete from checkitems, checks
where checkitems.ckid = checks.ckid;
Read please:
http://www.postgresql.org/docs/8.1/interactive/release-8-1.html
,----
| add_missing_from is now false by default (Neil)
|
| By default, we now generate an error if a table is used in a query
| without a FROM reference. The old behavior is still available, but the
| parameter must be set to 'true' to obtain it.
`----
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: new rule syntax?
2006-02-05 12:00 new rule syntax? A. R. Van Hook <hook@lake-lotawana.mo.us>
@ 2006-02-06 09:49 ` Richard Huxton <dev@archonet.com>
2 siblings, 0 replies; 5+ messages in thread
From: Richard Huxton @ 2006-02-06 09:49 UTC (permalink / raw)
To: A. R. Van Hook <hook@lake-lotawana.mo.us>; +Cc: pgsql-sql
A. R. Van Hook wrote:
> I have two tables defined as:
> checks
> (ckid int NOT null PRIMARY KEY,
> payto text,
> notes text,
> ckdate date,
> printed int default 0,
> tdate timestamp not null)
> checkitems
> (item int not null,
> ckid int NOT null references checks,
> itemtype int not null,
> amt numeric(7,3),
> primary key (item, ckid))
>
> in previous versions (<8.1) the following rule declaration seemed to
> work fine
Others have addresses your query with the rule. Can I ask why you're not
using a DELETE CASCADE on the fkey?
...
ckid int NOT null references checks ON DELETE CASCADE,
...
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-02-06 09:49 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-05 12:00 new rule syntax? A. R. Van Hook <hook@lake-lotawana.mo.us>
2006-02-05 13:10 ` Milen A. Radev <milen@radev.net>
2006-02-05 16:20 ` Jim Buttafuoco <jim@contactbda.com>
2006-02-05 13:17 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-02-06 09:49 ` Richard Huxton <dev@archonet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox