Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites

2004-11-11 Thread Greg Stark
Bruno Wolff III [EMAIL PROTECTED] writes: I don't think you should be rewriting queries as much as providing alternate plans and letting the rest of the optimizer decided which plan to use. If you just rewrite a query you might lock yourself into using a poor plan. Moreover, none of these

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Patrick B Kelly
On Nov 10, 2004, at 6:10 PM, Andrew Dunstan wrote: The last really isn't an option, because the whole point of CSVs is to play with other programs, and my understanding is that those that understand multiline fields (e.g. Excel) expect them not to be escaped, and do not produce them escaped.

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread John Hansen
Oleg, For example: The DMOZ topic: Top/World/Español/Países/México/Referencia/Bibliotecas/Nacionales select text2ltree(replace('Top/World/Español/Países/México/Referencia/Bibliotecas/Nacionales','/','.')); ERROR: syntax error at position 14 near à I've also found that topics contain ,

Re: [PATCHES] [HACKERS] plperl Safe restrictions

2004-11-11 Thread Bruce Momjian
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it. ---

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread Oleg Bartunov
Hmm, I don't see the error comes from ltree module, not from 'replace' function. Also, are you sure your postgresql setup is ok (locale issue). On Thu, 11 Nov 2004, John Hansen wrote: Oleg, For example: The DMOZ topic: Top/World/Espa??ol/Pa??ses/M?xico/Referencia/Bibliotecas/Nacionales select

Re: [HACKERS] plperl Safe restrictions

2004-11-11 Thread Bruce Momjian
Andrew, can you or someone summarize were we left this issue and your patch? --- Andrew Dunstan wrote: Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] writes: The question in my mind is What are we

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Tom Lane
Zeugswetter Andreas DAZ SD [EMAIL PROTECTED] writes: How are you planning to represent the association between MIN/MAX and particular index orderings in the system catalogs? Don't we already have that info to decide whether an index handles an ORDER BY without a sort node ? We know how to

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread Oleg Bartunov
John, On Thu, 11 Nov 2004, John Hansen wrote: Hello folks, It seems that the ltree module does not support the data for which is was (aparantly) created. The DMOZ data is encoded in UTF8, but ISALNUM() does not support unicode characters... In fact, it does not support any database encoding. Is

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query

2004-11-11 Thread Simon Riggs
On Wed, 2004-11-10 at 22:48, Mark Kirkwood wrote: Planning for future note: I would like whatever mechanism that is added for this MAX/MIN stuff to be amenable to more subtle things like aggregate navigation (see R.Kimball's article http://www.dbmsmag.com/9608d54.html). With you on that

[HACKERS] newbie compile question. please help

2004-11-11 Thread Gevik Babakhani
Dear Folks, Could someone please tell what I am doing wrong? I made some minor changes to main.c then make then make install when I want to start the postmaster I get The program postmaster was found by /home/gevik/postgres/build2/bin/pg_ctl but was not the same version as

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Alvaro Herrera
On Thu, Nov 11, 2004 at 01:08:39AM -0500, Tom Lane wrote: Alvaro Herrera [EMAIL PROTECTED] writes: What about having a new column in pg_aggregate which would point to a function that would try to optimize the aggregate's handling? I can't get very excited about this, because how would you

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites

2004-11-11 Thread Bruno Wolff III
On Thu, Nov 11, 2004 at 01:18:05 -0600, Jim C. Nasby [EMAIL PROTECTED] wrote: Certainly handling only one case is better than none. I just wanted to bring up the multiple aggregate scenario. Also, consider that SELECT min(a), max(a), min(b), max(c) FROM table could be optimized as well

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Andrew Dunstan
Patrick B Kelly wrote: On Nov 10, 2004, at 6:10 PM, Andrew Dunstan wrote: The last really isn't an option, because the whole point of CSVs is to play with other programs, and my understanding is that those that understand multiline fields (e.g. Excel) expect them not to be escaped, and do not

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread Oleg Bartunov
John, I miss about UTF-8 :) ltree doesn't supports UTF-8 yet. Oleg On Thu, 11 Nov 2004, John Hansen wrote: Oleg, For example: The DMOZ topic: Top/World/Espa??ol/Pa??ses/M?xico/Referencia/Bibliotecas/Nacionales select

Re: [HACKERS] Vacuum info clarification

2004-11-11 Thread Dave Cramer
While we are at it An explanation of what DETAIL: 0 dead row versions cannot be removed yet There were 1 unused item pointers. mean would be useful. Dave Bruce Momjian wrote: The last two lines of VACUUM VERBOSE are: INFO: free space map: 49 relations, 32 pages stored; 784 total pages needed

Re: [PATCHES] [HACKERS] plperl Safe restrictions

2004-11-11 Thread Bruce Momjian
Andrew Dunstan wrote: ... The patch also does some other inconsequential tidying of overlong lines, and removes some unnecessary ops in the unsafe case. These are basically cosmetic - the only significant part is replacing this: $PLContainer-permit(':base_math'); with

Re: [HACKERS] Increasing the length of

2004-11-11 Thread Robert Treat
On Wed, 2004-11-10 at 17:57, Andrew Sullivan wrote: On Wed, Nov 10, 2004 at 05:51:01PM -0500, Andrew Sullivan wrote: log_statement_after_min_duration (integer) -- which did what Simon wants. Uh, well, not what Simon wants, of course, but which gave us a useful capability anyway. I

Re: [HACKERS] Increasing the length of

2004-11-11 Thread Andrew Sullivan
On Thu, Nov 11, 2004 at 10:20:43AM -0500, Robert Treat wrote: I believe the geeky non-helpful answer is to attach to the process with gdb and do p debug_query_string which I believe will show you said long running query. Yes, this will work, I've used it. But of course, you don't actually

Re: [PATCHES] [HACKERS] plperl Safe restrictions

2004-11-11 Thread Andrew Dunstan
Bruce Momjian wrote: Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it.

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Zeugswetter Andreas DAZ SD
How are you planning to represent the association between MIN/MAX and particular index orderings in the system catalogs? Don't we already have that info to decide whether an index handles an ORDER BY without a sort node ? Andreas ---(end of

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Bruno Wolff III
On Thu, Nov 11, 2004 at 17:52:19 +1100, John Hansen [EMAIL PROTECTED] wrote: Why not just change the function all together to 'select $1 from $2 order by $1 desc limit 1;' Is there ANY situation where max(col) as it is, would be faster? Yes. A couple I can think of are: When count(col) is

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query

2004-11-11 Thread Greg Stark
Simon Riggs [EMAIL PROTECTED] writes: On Wed, 2004-11-10 at 22:48, Mark Kirkwood wrote: Planning for future note: I would like whatever mechanism that is added for this MAX/MIN stuff to be amenable to more subtle things like aggregate navigation (see R.Kimball's article

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Tom Lane
Bruno Wolff III [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] wrote: We know how to determine that an index matches an ORDER BY clause. But what has an aggregate called MAX() got to do with ORDER BY? Wouldn't knowing an opclass and direction associated with an aggregrate function

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Greg Stark
Tom Lane [EMAIL PROTECTED] writes: As a real-world example of why I won't hold still for hard-wiring this: a complex-number data type might have btree opclasses allowing it to be sorted either by real part or by absolute value. One might then define max_real() and max_abs() aggregates on

[HACKERS] newbie compile question. please help

2004-11-11 Thread gevik
Dear Folks, Could someone please tell me what I am doing wrong here? I made some minor changes to main.c then make then make install when I want to start the postmaster I get ** The program postmaster was found by

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Bruno Wolff III
On Thu, Nov 11, 2004 at 10:24:34 -0500, Tom Lane [EMAIL PROTECTED] wrote: We know how to determine that an index matches an ORDER BY clause. But what has an aggregate called MAX() got to do with ORDER BY? Magic assumptions about operators named are not acceptable answers; there has to be

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query

2004-11-11 Thread Bruno Wolff III
On Thu, Nov 11, 2004 at 09:29:14 +, Simon Riggs [EMAIL PROTECTED] wrote: On Wed, 2004-11-10 at 22:48, Mark Kirkwood wrote: Planning for future note: I would like whatever mechanism that is added for this MAX/MIN stuff to be amenable to more subtle things like aggregate navigation

Re: [HACKERS] newbie compile question. please help

2004-11-11 Thread Tom Lane
[EMAIL PROTECTED] writes: I made some minor changes to main.c then make then make install when I want to start the postmaster I get The program postmaster was found by /home/gevik/postgres/build2/bin/pg_ctl but was not the same version as pg_ctl. Maybe you did something that broke

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes: Patrick B Kelly wrote: Actually, when I try to export a sheet with multi-line cells from excel, it tells me that this feature is incompatible with the CSV format and will not include them in the CSV file. It probably depends on the version. I have

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes: It would also make it possible to deprecate DISTINCT ON in favour of GROUP BY with first() calls. Oh? How is a first() aggregate going to know what sort order you want within the group? AFAICS first() is only useful when you honestly do not care which

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Re: knowing internal representation, I think this is required anyway; else the optimization would only work on a very limited numer of situations. The point of my remark is that pushing this knowledge out to a function is helpful only if you can put

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] writes: Patrick B Kelly wrote: Actually, when I try to export a sheet with multi-line cells from excel, it tells me that this feature is incompatible with the CSV format and will not include them in the CSV file. It probably

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Greg Stark
Tom Lane [EMAIL PROTECTED] writes: I would vote in favor of removing the current code that attempts to support unquoted newlines, and waiting to see if there are complaints. Uhm. *raises hand* I agree with your argument but one way or another I have to load these CSVs I'm given. And like it

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread John Hansen
I miss about UTF-8 :) ltree doesn't supports UTF-8 yet. ok,. how about all the 'other' characters from us-ascii : ,[EMAIL PROTECTED]*()_+-=[]{}\|'?`~ these 'should' all be valid for the ltxtquery, ltree, and ltree[] types, except maybe for . which is used as seperator (and maybe . should be

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread David Fetter
On Thu, Nov 11, 2004 at 03:38:16PM -0500, Greg Stark wrote: Tom Lane [EMAIL PROTECTED] writes: I would vote in favor of removing the current code that attempts to support unquoted newlines, and waiting to see if there are complaints. Uhm. *raises hand* I agree with your argument

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Greg Stark
Tom Lane [EMAIL PROTECTED] writes: Greg Stark [EMAIL PROTECTED] writes: It would also make it possible to deprecate DISTINCT ON in favour of GROUP BY with first() calls. Oh? How is a first() aggregate going to know what sort order you want within the group? AFAICS first() is only

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: Oh? How is a first() aggregate going to know what sort order you want within the group? It would look something like select x,first(a),first(b) from (select x,a,b from table order by x,y) group by x which is

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Patrick B Kelly
On Nov 11, 2004, at 2:56 PM, Andrew Dunstan wrote: Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] writes: Patrick B Kelly wrote: Actually, when I try to export a sheet with multi-line cells from excel, it tells me that this feature is incompatible with the CSV format and will not include them

[HACKERS] GUC custom variables broken

2004-11-11 Thread Thomas Hallgren
I have the following in my postgresql.conf custom_variable_classes = 'pljava' pljava.classpath = 'C:\\Tada\\Workspace\\org.postgresql.pljava\\build\\pljava.jar' It worked fine with 8.0.0beta2. The beta4 however, gives me the following message: FATAL: unrecognized configuration parameter

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Andrew Dunstan
Patrick B Kelly wrote: What about just coding a FSM into backend/commands/copy.c:CopyReadLine() that does not process any flavor of NL characters when it is inside of a data field? It would be a major change - the routine doesn't read data a field at a time, and has no idea if we are even

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Tom Lane
Patrick B Kelly [EMAIL PROTECTED] writes: What about just coding a FSM into backend/commands/copy.c:CopyReadLine() that does not process any flavor of NL characters when it is inside of a data field? CopyReadLine has no business tracking that. One reason why not is that it is dealing with

Re: [HACKERS] A modest proposal: get rid of GUC's USERLIMIT

2004-11-11 Thread Andrew McMillan
On Wed, 2004-11-10 at 11:45 -0500, Tom Lane wrote: Andrew McMillan [EMAIL PROTECTED] writes: When tracking down gnarly problems in heavily multi-user applications enabling higher log levels at selective points has the potential to help _a lot_ with diagnostic detail, without smothering you

Re: [HACKERS] GUC custom variables broken

2004-11-11 Thread Tom Lane
Thomas Hallgren [EMAIL PROTECTED] writes: What happened? I broke it :-(. Fix committed. regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [HACKERS] GUC custom variables broken

2004-11-11 Thread Thomas Hallgren
Thomas Hallgren wrote: I have the following in my postgresql.conf custom_variable_classes = 'pljava' pljava.classpath = 'C:\\Tada\\Workspace\\org.postgresql.pljava\\build\\pljava.jar' It worked fine with 8.0.0beta2. The beta4 however, gives me the following message: FATAL: unrecognized

Re: [HACKERS] newbie compile question. please help

2004-11-11 Thread Dave Cramer
Check the path of pg_ctl and postmaster, you must have two versions on the machine somewhere. Dave [EMAIL PROTECTED] wrote: Dear Folks, Could someone please tell me what I am doing wrong here? I made some minor changes to main.c then make then make install when I want to start the postmaster I

Re: [HACKERS] GUC custom variables broken

2004-11-11 Thread Thomas Hallgren
Tom Lane wrote: I broke it :-(. Fix committed. Thanks, that was quick. You fixed it before I managed to find it. Not that I'm in an extreme hurry, just curious. Are we using different CVS repositories with some latency in replication or something? I don't seem to get your fix yet. Regards,

Re: [HACKERS] MAX/MIN optimization via rewrite (plus query rewrites generally)

2004-11-11 Thread Greg Stark
Tom Lane [EMAIL PROTECTED] writes: Greg Stark [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: Oh? How is a first() aggregate going to know what sort order you want within the group? It would look something like select x,first(a),first(b) from (select x,a,b from table

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Patrick B Kelly
On Nov 11, 2004, at 6:16 PM, Tom Lane wrote: Patrick B Kelly [EMAIL PROTECTED] writes: What about just coding a FSM into backend/commands/copy.c:CopyReadLine() that does not process any flavor of NL characters when it is inside of a data field? CopyReadLine has no business tracking that. One

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Andrew Dunstan
Patrick B Kelly wrote: My suggestion is to simply have CopyReadLine recognize these two states (in-field and out-of-field) and execute the current logic only while in the second state. It would not be too hard but as you mentioned it is non-trivial. We don't know what state we expect the

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Patrick B Kelly
On Nov 11, 2004, at 10:07 PM, Andrew Dunstan wrote: Patrick B Kelly wrote: My suggestion is to simply have CopyReadLine recognize these two states (in-field and out-of-field) and execute the current logic only while in the second state. It would not be too hard but as you mentioned it is

Re: [HACKERS] GUC custom variables broken

2004-11-11 Thread Bruce Momjian
Thomas Hallgren wrote: Tom Lane wrote: I broke it :-(. Fix committed. Thanks, that was quick. You fixed it before I managed to find it. Not that I'm in an extreme hurry, just curious. Are we using different CVS repositories with some latency in replication or something? I don't seem

Re: [HACKERS] A modest proposal: get rid of GUC's USERLIMIT

2004-11-11 Thread Bruce Momjian
Andrew McMillan wrote: -- Start of PGP signed section. On Wed, 2004-11-10 at 11:45 -0500, Tom Lane wrote: Andrew McMillan [EMAIL PROTECTED] writes: When tracking down gnarly problems in heavily multi-user applications enabling higher log levels at selective points has the potential to

Re: [HACKERS] newbie compile question. please help

2004-11-11 Thread Gevik Babakhani
Problem solved. I added some printf statements in order do print some debug information. The tools like pg_ctl always run postmaster -V in order to get the version number. The printf statements that I added, printed extra info which pg_ctl could not understand. Therefore I got the error.

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Bruce Momjian
Can I see an example of such a failure line? --- Andrew Dunstan wrote: Darcy Buskermolen has drawn my attention to unfortunate behaviour of COPY CSV with fields containing embedded line end chars if the embedded

Re: [HACKERS] multiline CSV fields

2004-11-11 Thread Tom Lane
Patrick B Kelly [EMAIL PROTECTED] writes: I may not be explaining myself well or I may fundamentally misunderstand how copy works. Well, you're definitely ignoring the character-set-conversion issue. regards, tom lane ---(end of

Re: [HACKERS] ltree PostgreSQL Module

2004-11-11 Thread Oleg Bartunov
On Fri, 12 Nov 2004, John Hansen wrote: I miss about UTF-8 :) ltree doesn't supports UTF-8 yet. ok,. how about all the 'other' characters from us-ascii : ,[EMAIL PROTECTED]*()_+-=[]{}\|'?`~ these 'should' all be valid for the ltxtquery, ltree, and ltree[] types, except maybe for . which is used as