Re: Default ordering option

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Cyril Champier <cyril(dot)champier(at)doctolib(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Default ordering option
Date: 2019-07-26 08:10:24
Message-ID: CAOBaU_bEuhPcv-aCaQBz3V+6k8PzG8_fV70-TYFGy1X1PjZsdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 26, 2019 at 9:53 AM Cyril Champier
<cyril(dot)champier(at)doctolib(dot)com> wrote:
>
> Adrian:
>
>> Are you really looking for a pseudo-random name?
>
>
> No, the code I pasted was an existing production bug: the last_name should have been unique, so the selected patient would always be the same.
> This should have been detected in tests, but since the order was "almost always the same", our test was green 99% of the time, so we discarded it as flaky.

If the filter should return at most 1 row, why put a LIMIT in the
first place? Even with a forced random() you won't get a failure
every time, while asserting there's at most 1 row returned is
guaranteed to fail?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cyril Champier 2019-07-26 08:14:24 Re: Default ordering option
Previous Message Luca Ferrari 2019-07-26 08:06:18 Re: Too slow to create new schema and their tables, functions, triggers.