Skip site navigation (1) Skip section navigation (2)

Re: Unit tests and ordering

From: "John Lister" <john(dot)lister-ps(at)kickstone(dot)com>
To: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Unit tests and ordering
Date: 2009-04-20 08:47:55
Message-ID: D224EADFF0F2461B95D30BEDAB54564A@squarepi.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
>> This seems to be an ordering problem.. The dates are inserted and then
>> the test relies on them being returned in the same order they were
>> inserted. I'm fairly sure that this isn't guaranteed when using SQL,
>
> Correct. Your tests are broken, you REALLY need an ORDER BY clause if you 
> depend on the order of the result set. Alternately, adjust your tests to 
> not care about the result set order.

I thought so...

>> however it looks like it probably worked before.
>
> The only major change I can personally think of that might've affected 
> that is synchronized scans. If you have more than one backend reading the 
> table at once using a sequential scan, one of them will usually pick up 
> part-way through the table then go back to the beginning once it hits the 
> end. I'm not sure if that's likely to be related to what you're seeing.
>
> In any case, you REALLY need an appropriate ORDER BY clause.

It should be simple to correct the tests, by adding a serial id field and 
ordering on that...

Thanks

JOHN 


In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2009-04-20 21:51:27
Subject: Re: Query preparation
Previous:From: Craig RingerDate: 2009-04-20 01:09:59
Subject: Re: Unit tests and ordering

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group