Re: [GENERAL] Strange result with SELECT ... ORDER BY random() LIMIT 1 and JOINs

2013-11-08 Thread Tom Lane
Etienne Dube etd...@gmail.com writes: This query yields unexpected results (tested under 9.2.4): SELECT s.car_id, s.color_id AS subquery_color_id, co.color_id AS join_color_id, co.color_name FROM ( SELECT ca.car_id, (

[GENERAL] Strange result with SELECT ... ORDER BY random() LIMIT 1 and JOINs

2013-08-15 Thread Etienne Dube
Hello, Consider the following tables and data: CREATE TABLE color ( color_id integer PRIMARY KEY, color_name text ); INSERT INTO color (color_id, color_name) VALUES (1, 'red'), (2, 'blue'), (3, 'green'), (4, 'yellow'), (5,

Re: [GENERAL] Strange result with SELECT ... ORDER BY random() LIMIT 1 and JOINs

2013-08-15 Thread Adrian Klaver
On 08/15/2013 11:46 AM, Etienne Dube wrote: Hello, I don't really understand what is going on there, the result appears incorrect to me. The following page seems to offer some explanations as to what is happening: http://sql-info.de/postgresql/postgres-gotchas.html#1_6 . Indeed, adding