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


Groups > comp.databases.postgresql > #782

SQL command gives different result when done in function

X-Received by 10.107.6.142 with SMTP id f14mr6586247ioi.97.1496048876608; Mon, 29 May 2017 02:07:56 -0700 (PDT)
X-Received by 10.157.4.34 with SMTP id 31mr303878otc.2.1496048876543; Mon, 29 May 2017 02:07:56 -0700 (PDT)
Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!news.glorb.com!67no1230162itx.0!news-out.google.com!m134ni411itb.0!nntp.google.com!67no1230156itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.databases.postgresql
Date Mon, 29 May 2017 02:07:56 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=36.84.58.242; posting-account=on2AMgoAAADC-JrgyEcVjA3Qkdwhzub6
NNTP-Posting-Host 36.84.58.242
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <28abb49e-321a-45ac-9562-16f0bc301c46@googlegroups.com> (permalink)
Subject SQL command gives different result when done in function
From neojustebelmont@gmail.com
Injection-Date Mon, 29 May 2017 09:07:56 +0000
Content-Type text/plain; charset="UTF-8"
Xref csiph.com comp.databases.postgresql:782

Show key headers only | View raw


Hello all.

I have an SQL command that is somewhere like

"SELECT value FROM table WHERE date = '2017-02-28' AND product_id = 100 LIMIT 1"

There are multiple rows if I don't use limit. But for convenience's sake, I'll say I get the value row to be "A"

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

Thank you.

Back to comp.databases.postgresql | Previous | NextNext 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