dbTalk Databases Forums  

[BUGS] BUG #1854: SQL Bug

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1854: SQL Bug in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Christian Almeida
 
Posts: n/a

Default [BUGS] BUG #1854: SQL Bug - 08-29-2005 , 08:22 AM







The following bug has been logged online:

Bug reference: 1854
Logged by: Christian Almeida
Email address: cbalmeida (AT) gmail (DOT) com
PostgreSQL version: 8.0
Operating system: Windows XP SP2
Description: SQL Bug
Details:

Should this sql work?

I just picked 3 tables from pg_catalog and build this query. It really
should not work, because there's a reference to a table
(PG_CATALOG.PG_CLASS) wich is not listed in any from clauses.

Try it yourself:

SELECT
*
FROM
PG_CATALOG.PG_AM
WHERE
NOT EXISTS
(
SELECT
1
FROM
PG_CATALOG.PG_CAST
WHERE
PG_CATALOG.PG_CLASS.RELOWNER = PG_CATALOG.PG_AM.AMOWNER
)

Cheers,

Christian Almeida.

SELECT
*
FROM
PG_CATALOG.PG_AM
WHERE
NOT EXISTS
(
SELECT
1
FROM
PG_CATALOG.PG_CAST
WHERE
PG_CATALOG.PG_CLASS.RELOWNER = PG_CATALOG.PG_AM.AMOWNER
)

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
  #2  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: [BUGS] BUG #1854: SQL Bug - 08-29-2005 , 11:16 AM







On Mon, 29 Aug 2005, Christian Almeida wrote:

Quote:
Should this sql work?
Yes and no. Whether this errors or adds the reference is controlled by
a configuration variable, add_missing_from. For backwards compatibility
reasons (and for allowing outside table references in delete) the variable
currently defaults to on IIRC. At some point in the future the default
will likely change to off.


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #3  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: [BUGS] BUG #1854: SQL Bug - 08-29-2005 , 11:31 AM



On Mon, Aug 29, 2005 at 09:11:06 -0700,
Stephan Szabo <sszabo (AT) megazone (DOT) bigpanda.com> wrote:
Quote:
On Mon, 29 Aug 2005, Christian Almeida wrote:

Should this sql work?

Yes and no. Whether this errors or adds the reference is controlled by
a configuration variable, add_missing_from. For backwards compatibility
reasons (and for allowing outside table references in delete) the variable
currently defaults to on IIRC. At some point in the future the default
will likely change to off.
Unless things change it will be off by default in 8.1. This is mentioned
in the release notes. There is now a USING clause for DELETE which covers
the case that couldn't previously be handled without the missing from
feature.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #4  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1854: SQL Bug - 08-29-2005 , 11:32 AM



On Mon, Aug 29, 2005 at 09:11:06AM -0700, Stephan Szabo wrote:
Quote:
On Mon, 29 Aug 2005, Christian Almeida wrote:
Should this sql work?

Yes and no. Whether this errors or adds the reference is controlled by
a configuration variable, add_missing_from. For backwards compatibility
reasons (and for allowing outside table references in delete) the variable
currently defaults to on IIRC. At some point in the future the default
will likely change to off.
add_missing_from will be off by default in 8.1.

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.