Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #783

Re: SQL command gives different result when done in function

From Dimitri Fontaine <dimitri.fontaine@schibsted.com>
Newsgroups comp.databases.postgresql
Subject Re: SQL command gives different result when done in function
Date 2017-05-29 11:20 +0200
Organization A noiseless patient Spider
Message-ID <m2y3tgvx28.fsf@dimitris-mbp.home> (permalink)
References <28abb49e-321a-45ac-9562-16f0bc301c46@googlegroups.com>

Show all headers | View raw


neojustebelmont@gmail.com writes:
> Now I put that SQL into a function. And when the function is called, it
> instead gave out "C", which also fulfilled the date and product_id
> requirement.
>
> Is there a way I could get "A" no matter what? Hopefully without adding
> extra WHERE clauses

The only way to know in which order you get the rows in SQL is to use
the ORDER BY clause. I don't think it makes any sense to use the LIMIT
clause without an ORDER BY clause, apart from interactive data discovery
at the prompt.

-- 
Dimitri Fontaine
PostgreSQL DBA, Architecte

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

SQL command gives different result when done in function neojustebelmont@gmail.com - 2017-05-29 02:07 -0700
  Re: SQL command gives different result when done in function Dimitri Fontaine <dimitri.fontaine@schibsted.com> - 2017-05-29 11:20 +0200
  Re: SQL command gives different result when done in function DFS <nospam@dfs.com> - 2017-05-29 22:07 -0400

csiph-web