pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Outer Join with For Update
2+ messages / 2 participants
[nested] [flat]

* Outer Join with For Update
@ 2002-09-03 18:05  alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
  0 siblings, 1 reply; 2+ messages in thread

From: alexandre :: aldeia digital @ 2002-09-03 18:05 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

I work with a case tool named Genexus. This tool generate the
applications in VB, VFox, Java, C, etc. in DB2, Oracle, M$ SQL and
now supports postgresql in VB and JAVA generator, making a good job
(excepting when it use a "optimize for", "/*fastfirstrows*/"
or "fast(n)" for the other 3 DB ... postgresql does not have this
optimization clauses, making certains querys slow when compared
with others).

But I found a problem (this query is the same for DB2 and postgres
and the database tables/data are equal):

SELECT A.id, B.desc from A left join B ON B.id=A.id FOR UPDATE OF A,B

If I have a null rellation in B, the error in postgres is:

"SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN"

DB2 simply ignore the FOR UPDATE ...
I think that is the correct form...I don´t know when the LEFT ou RIGHT
JOIN will be null...

I remove the check in initsplan.c (line 324/325), but postgres
returns :

"ERROR:  ExecutePlan: (junk) `ctid2' is NULL!"

Like other case tools, I don´t have the possibility to change
the query in code forever...

Any tips?!?!

Thank´s all and sorry for this big email and a poor english... :)

Alexandre Arruda Paes
Aldeia Digital
Brazil







^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Outer Join with For Update
@ 2002-09-03 21:31  Tom Lane <tgl@sss.pgh.pa.us>
  parent: alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-09-03 21:31 UTC (permalink / raw)
  To: alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>; +Cc: pgsql-sql

"alexandre :: aldeia digital" <alepaes@aldeiadigital.com.br> writes:
> SELECT A.id, B.desc from A left join B ON B.id=A.id FOR UPDATE OF A,B
> If I have a null rellation in B, the error in postgres is:
> "SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN"

Yup.

> DB2 simply ignore the FOR UPDATE ...
> I think that is the correct form...

That seems obviously wrong to me.  What good is a FOR UPDATE if it fails
to lock down the rows that created your result?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-09-03 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-03 18:05 Outer Join with For Update alexandre :: aldeia digital <alepaes@aldeiadigital.com.br>
2002-09-03 21:31 ` Tom Lane <tgl@sss.pgh.pa.us>

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