dbTalk Databases Forums  

Re: [BUGS] Improper processing of random values in sub-queries

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


Discuss Re: [BUGS] Improper processing of random values in sub-queries in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Improper processing of random values in sub-queries - 07-09-2004 , 10:12 PM






David Newall <davidn-postgres (AT) rebel (DOT) net.au> writes:
Quote:
NOW CONSIDER the following query, executed using psql:

SELECT i, j from (
SELECT i, ((i + 18 * random())::integer % 20 + 1) AS j FROM data
) foo WHERE j = 15;
Hmph. Evidently the planner should refuse to flatten subselects that
have volatile functions in their output list (and perhaps anywhere
else??). This will probably make some people unhappy, but I see no
other fix.

I assume though that this is a made-up example and is not the case
that's really troubling you. What is the actual problem you are looking
at?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #2  
Old   
davidn-postgres@rebel.net.au
 
Posts: n/a

Default Re: [BUGS] Improper processing of random values in sub-queries - 07-16-2004 , 01:51 PM






Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> wrote:
Quote:
I assume though that this is a made-up example and is not the case
that's really troubling you. What is the actual problem you are looking
at?
I was generating random test data and naively assumed that ()::integer
truncated its value, therefore I was getting duplicate values. Once I
I realised that random()::integer was rounded I had no further problem,
but figured should report the bug that I had already noticed.

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


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.