Re: [BUGS] BUG #4927: psql does "spoil" the query before sending it to server

2009-07-17 Thread Euler Taveira de Oliveira
Tom Lane escreveu: > Euler Taveira de Oliveira writes: >> Why are we analysing the query there? One possible fix is to remove the '.' >> as >> delimiter in strtokx(). The trivial patch is attached. > > Surely that would break a lot of other cases. > Why? Even if it can't catch all cases when we

Re: [BUGS] BUG #4926: too few pathkeys for mergeclauses

2009-07-17 Thread Tom Lane
"Roman Kononov" writes: > Description:too few pathkeys for mergeclauses I've applied a patch for this. Thanks for the report. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.post

Re: [BUGS] BUG #4927: psql does "spoil" the query before sending it to server

2009-07-17 Thread Tom Lane
Euler Taveira de Oliveira writes: > Why are we analysing the query there? One possible fix is to remove the '.' as > delimiter in strtokx(). The trivial patch is attached. Surely that would break a lot of other cases. regards, tom lane -- Sent via pgsql-bugs mailing lis

Re: [BUGS] BUG #4927: psql does "spoil" the query before sending it to server

2009-07-17 Thread Euler Taveira de Oliveira
handling numeric literals with dots in psql copy command escreveu: > fi...@filip=# \copy ( select 1.23::numeric as num ) to 'out.csv' with csv > header > ERROR: syntax error at or near "." > LINE 1: COPY ( select 1 . 23::numeric as num ) TO STDOUT CSV HEADER > ^ > \copy: ER

Re: [BUGS] BUG #4926: too few pathkeys for mergeclauses

2009-07-17 Thread Tom Lane
I wrote: > I think what this case may show is simply that the consistency > checking I added to create_mergejoin_plan in 8.3 is too strict. > Not quite convinced yet though. After further review I think that is the correct approach to take. The proximate cause of the problem is that find_mergecla

Re: [BUGS] bug or simply not enough stack space?

2009-07-17 Thread Frank van Vugt
Hi Tom, > Hmm ... the relevant code change seems to have been > http://archives.postgresql.org/pgsql-committers/2009-04/msg00127.php Well, though not during beta, the field testing did pay off ;) > I think I might have been overenthusiastic in trying to free resources > during a subtransaction a

Re: [BUGS] BUG #4926: too few pathkeys for mergeclauses

2009-07-17 Thread Tom Lane
Heikki Linnakangas writes: > Version 8.3 has the same bug, apparently introduced along with the > equivalence classes. In 8.2, the merge condition is reduced into (i=x > AND i=y), IOW the planner eliminates the duplicate condition. I believe > 8.2 would otherwise have the same problem as well. Th

Re: [BUGS] bug or simply not enough stack space?

2009-07-17 Thread Tom Lane
Frank van Vugt writes: > So this took a while, but here's your test case. > Turns out to be quite small actually ;) Hmm ... the relevant code change seems to have been http://archives.postgresql.org/pgsql-committers/2009-04/msg00127.php I think I might have been overenthusiastic in trying to

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Greg Stark
I don't think it even has to be so specific. We should just always rewrite bool <> bool into bool = NOT bool. Hmm. That only has a 50/50 chance of creating an indexable clause. Perhaps we could even rewrite it as "a = NOT b AND NOT a = b". -- Greg On 2009-07-17, at 3:21 PM, Tom Lane wro

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Tom Lane
Peter Eisentraut writes: > ... But again, this is data type specific knowledge. Actually, now that I think about it, the planner already has datatype-specific knowledge about boolean equality (see simplify_boolean_equality). It would take just a few more lines of code there to recognize "x <> tr

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Tom Lane
Jan-Ivar Mellingen writes: > One of our customers discovered that by replacing <>TRUE with =FALSE in > a query of a table containing 750.000 records reduced the query time > from about 12 seconds to about 60 milliseconds! This is not a bug. The set of operators that are indexable is well documen

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Peter Eisentraut
On Friday 17 July 2009 12:45:47 Mikael Krantz wrote: > It might be that your column may be NULL as well as TRUE or FALSE. I > am no expert in this matter though. Nulls also need to be considered when attempting to substitute purportedly equivalent clauses. But in this case it wouldn't actually m

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Mikael Krantz
It might be that your column may be NULL as well as TRUE or FALSE. I am no expert in this matter though. /M On Fri, Jul 17, 2009 at 10:12 AM, Jan-Ivar Mellingen wrote: > One of our customers discovered that by replacing <>TRUE with =FALSE in > a query of a table containing 750.000 records reduced

[BUGS] BUG #4927: psql does "spoil" the query before sending it to server

2009-07-17 Thread handling numeric literals with dots in psql copy command
The following bug has been logged online: Bug reference: 4927 Logged by: handling numeric literals with dots in psql \copy command Email address: filip.rembialkow...@gmail.com PostgreSQL version: 8.4.0 Operating system: Linux Description:psql does "spoil" the query be

Re: [BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Peter Eisentraut
On Friday 17 July 2009 11:12:41 Jan-Ivar Mellingen wrote: > One of our customers discovered that by replacing <>TRUE with =FALSE in > a query of a table containing 750.000 records reduced the query time > from about 12 seconds to about 60 milliseconds! > This is a dramatical difference, but I cann

Re: [BUGS] bug or simply not enough stack space?

2009-07-17 Thread Frank van Vugt
Ok, So this took a while, but here's your test case. Turns out to be quite small actually ;) create table t1 (id int); CREATE FUNCTION tr_t1_after_iud() RETURNS trigger LANGUAGE 'plpgsql' VOLATILE STRICT SECURITY INVOKER AS 'DECLARE BEGIN RAISE NOTICE ''%'', ROW(NEW.*); SELECT 1/0; RET

[BUGS] Huge speed penalty using <>TRUE instead of =FALSE

2009-07-17 Thread Jan-Ivar Mellingen
One of our customers discovered that by replacing <>TRUE with =FALSE in a query of a table containing 750.000 records reduced the query time from about 12 seconds to about 60 milliseconds! The problematic query looks like this: SELECT * FROM AlarmLogg WHERE Logg_avsluttet <> TRUE AND Alarm_status=

Re: [BUGS] BUG #4926: too few pathkeys for mergeclauses

2009-07-17 Thread Heikki Linnakangas
Heikki Linnakangas wrote: > 2. make_inner_pathkeys_for_merge() should have created sort order (x, y, > x) for the inner side. On further thought, that would make no sense. Sort order (x, y) is always equivalent to (x, y, x). -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -

Re: [BUGS] BUG #4926: too few pathkeys for mergeclauses

2009-07-17 Thread Heikki Linnakangas
Greg Stark wrote: > On Thu, Jul 16, 2009 at 9:07 PM, Roman Kononov wrote: >> test=# create table junk(i int); >> CREATE TABLE >> test=# select * from junk left outer join (select coalesce(i,1) as x, >> coalesce(i,2) as y from junk) t on coalesce(i,3)=x and coalesce(i,4)=y and >> coalesce(i,5)=x; >>