Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Bruce Momjian
Heikki Linnakangas wrote: > On 06.09.2011 20:53, Bruce Momjian wrote: > > Tom Lane wrote: > >> Bruce Momjian writes: > >>> Uh, have we addressed this? I don't think so. > >> > >> No. IIRC, I didn't like Heikki's proposed patch, so it's on my head > >> to come up with something better. > > > > Yo

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Heikki Linnakangas
On 06.09.2011 20:53, Bruce Momjian wrote: Tom Lane wrote: Bruce Momjian writes: Uh, have we addressed this? I don't think so. No. IIRC, I didn't like Heikki's proposed patch, so it's on my head to come up with something better. You can blame me for getting it into the parser. It used to

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Uh, have we addressed this? I don't think so. > > No. IIRC, I didn't like Heikki's proposed patch, so it's on my head > to come up with something better. You can blame me for getting it into the parser. It used to be in gram.y! -- Bruce Momjian

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Tom Lane
Bruce Momjian writes: > Uh, have we addressed this? I don't think so. No. IIRC, I didn't like Heikki's proposed patch, so it's on my head to come up with something better. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Bruce Momjian
Heikki Linnakangas wrote: > Nope, this hasn't been addressed. FWIW, I put it on the todo list when I > stopped working on it. Oh, I see it now. Thanks. --- > > On 06.09.2011 20:48, Bruce Momjian wrote: > > > > Uh, have we

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Heikki Linnakangas
Nope, this hasn't been addressed. FWIW, I put it on the todo list when I stopped working on it. On 06.09.2011 20:48, Bruce Momjian wrote: Uh, have we addressed this? I don't think so. --- Heikki Linnakangas wrote: On 0

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-09-06 Thread Bruce Momjian
Uh, have we addressed this? I don't think so. --- Heikki Linnakangas wrote: > On 02.04.2011 20:48, Tom Lane wrote: > > Heikki Linnakangas writes: > >> We sometimes transform IN-clauses to a list of ORs: > >> postgres=# exp

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-19 Thread Tom Lane
Heikki Linnakangas writes: > I'd like us to still fix this so that there's no multiple evaluation - > that would actually make BETWEEN more useful than it is today. I'm > working on a patch to handle both BETWEEN and IN. One other issue here is that the parser has traditionally handled BETWEEN

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-19 Thread Heikki Linnakangas
On 11.04.2011 19:33, Heikki Linnakangas wrote: On 11.04.2011 19:06, Kevin Grittner wrote: Heikki Linnakangas wrote: Hmm, the SQL specification explicitly says that X BETWEEN Y AND Z is equal to X>= Y AND X<= Z It doesn't say anything about side-effects of X. Seems like an oversight in the s

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-11 Thread Tom Lane
Heikki Linnakangas writes: > Does anyone object to making BETWEEN and IN more strict about the data > types? At the moment, you can do this: > postgres=# SELECT '1234' BETWEEN '10001'::text AND 10002::int4; > ?column? > -- > t > (1 row) > I'm thinking that it should throw an error.

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-11 Thread Heikki Linnakangas
On 11.04.2011 19:06, Kevin Grittner wrote: Heikki Linnakangas wrote: On 05.04.2011 18:42, Heikki Linnakangas wrote: On 05.04.2011 13:19, Marti Raudsepp wrote: On Fri, Apr 1, 2011 at 14:24, Heikki Linnakangas wrote: We sometimes transform IN-clauses to a list of ORs: postgres=# explain SEL

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-11 Thread Kevin Grittner
Heikki Linnakangas wrote: > On 05.04.2011 18:42, Heikki Linnakangas wrote: >> On 05.04.2011 13:19, Marti Raudsepp wrote: >>> On Fri, Apr 1, 2011 at 14:24, Heikki Linnakangas >>> wrote: We sometimes transform IN-clauses to a list of ORs: postgres=# explain SELECT * FROM foo WHERE a

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-11 Thread Heikki Linnakangas
On 05.04.2011 18:42, Heikki Linnakangas wrote: On 05.04.2011 13:19, Marti Raudsepp wrote: On Fri, Apr 1, 2011 at 14:24, Heikki Linnakangas wrote: We sometimes transform IN-clauses to a list of ORs: postgres=# explain SELECT * FROM foo WHERE a IN (b, c); QUERY PLAN Seq Scan on foo (cost=0.00..

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-05 Thread Heikki Linnakangas
On 05.04.2011 13:19, Marti Raudsepp wrote: On Fri, Apr 1, 2011 at 14:24, Heikki Linnakangas wrote: We sometimes transform IN-clauses to a list of ORs: postgres=# explain SELECT * FROM foo WHERE a IN (b, c); QUERY PLAN Seq Scan on foo (cost=0.00..39.10 rows=19 width=12

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-05 Thread Marti Raudsepp
On Fri, Apr 1, 2011 at 14:24, Heikki Linnakangas wrote: > We sometimes transform IN-clauses to a list of ORs: > > postgres=# explain SELECT * FROM foo WHERE a IN (b, c); >                      QUERY PLAN >  Seq Scan on foo  (cost=0.00..39.10 rows=19 width=12) >   Filter: ((a = b) OR (a = c)) > > B

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-02 Thread Tom Lane
Heikki Linnakangas writes: > We sometimes transform IN-clauses to a list of ORs: > postgres=# explain SELECT * FROM foo WHERE a IN (b, c); >QUERY PLAN > -- > Seq Scan on foo (cost=0.00..39.10 rows=19 width=12) > Fil

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-01 Thread Robert Haas
On Fri, Apr 1, 2011 at 7:24 AM, Heikki Linnakangas wrote: > My common sense says that that transformation > is not legal. +1. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To mak

Re: [HACKERS] Transforming IN (...) to ORs, volatility

2011-04-01 Thread Gianni Ciolli
On Fri, Apr 01, 2011 at 02:24:53PM +0300, Heikki Linnakangas wrote: > I tried to read the SQL spec to see if it has anything to say about > that, but I couldn't find anything. My common sense says that that > transformation is not legal. Your feeling is correct; I would motivate it as follows.

[HACKERS] Transforming IN (...) to ORs, volatility

2011-04-01 Thread Heikki Linnakangas
We sometimes transform IN-clauses to a list of ORs: postgres=# explain SELECT * FROM foo WHERE a IN (b, c); QUERY PLAN -- Seq Scan on foo (cost=0.00..39.10 rows=19 width=12) Filter: ((a = b) OR (a = c)) (2 rows) But w