Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Simon Riggs
On Wed, 2008-06-25 at 23:34 -0400, Robert Haas wrote: > I can predict that Tom will say that the planning time it would take > to avoid this problem isn't justified by the number of queries that it > would improve. > That's possible, but it's unfortunate that there's no > way to fiddle with the

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Martijn van Oosterhout
On Wed, Jun 25, 2008 at 11:47:39AM -0700, David E. Wheeler wrote: > * There seem to still be some implicit CASTS to text that I'd like to > duplicate. For example, select '192.168.1.2'::cidr::text;` works, but > `select '192.168.1.2'::cidr::citext;` does not. Where can I find the C > functio

[HACKERS] Join Removal/ Vertical Partitioning

2008-06-26 Thread Simon Riggs
There are common cases where we want to remove unwanted joins from queries, especially with view and Object Relational Mapping systems such as Hibernate etc.. (I've mentioned this before on -hackers or -perform, but I can't find the links) Typical case is where we have a class that has a subclass

[HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Marko Kreen
Docs seems to say it is, but following function fails to compile: create function err_else() returns void as $$ begin if 1 = 1 then else if 1 = 2 then end if; end; $$ language plpgsql; ERROR: syntax error at or near ";" LINE 6: end; Version 8.3.3. -- marko -- Sent via pgsql-hack

Re: [HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Pavel Stehule
hello 2008/6/26 Marko Kreen <[EMAIL PROTECTED]>: > Docs seems to say it is, but following function fails to compile: > > create function err_else() returns void as $$ > begin >if 1 = 1 then >else if 1 = 2 then >end if; > end; > $$ language plpgsql; > > ERROR: syntax error at or near "

Re: [HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Marko Kreen
On 6/26/08, Pavel Stehule <[EMAIL PROTECTED]> wrote: > 2008/6/26 Marko Kreen <[EMAIL PROTECTED]>: > > Docs seems to say it is, but following function fails to compile: > > > > create function err_else() returns void as $$ > > begin > >if 1 = 1 then > >else if 1 = 2 then > >end if

Re: [HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Pavel Stehule
2008/6/26 Marko Kreen <[EMAIL PROTECTED]>: > On 6/26/08, Pavel Stehule <[EMAIL PROTECTED]> wrote: >> 2008/6/26 Marko Kreen <[EMAIL PROTECTED]>: >> > Docs seems to say it is, but following function fails to compile: >> > >> > create function err_else() returns void as $$ >> > begin >> >if 1

Re: [HACKERS] Creating a VIEW with a POINT column

2008-06-26 Thread Dimitri Fontaine
Le jeudi 26 juin 2008, Tom Lane a écrit : > Yeah. The GROUP BY case is even more annoying, because we *have* the > planner/executor infrastructure to do it via hashing; but the parser > barfs immediately if there is not btree opclass support for the type. > I'm not sure how to fix the parser and t

Re: [HACKERS] MSVC 2003 compile error with pg8.3.3

2008-06-26 Thread Jeff McKenna
Thanks Hiroshi. Unfortunately libpq.dll does not compile with MSVC 2003. Has anyone successfully compiled libpq for 8.3.3 (or CVS head) with MSVC 2003?? --- Jeff McKenna FOSS4G Consulting and Training Services http://www.gatewaygeomatics.com/ On 24-Jun-08, at 8:31 PM, Hiroshi Saito wr

[HACKERS] get_relation_stats_hook()

2008-06-26 Thread Simon Riggs
Currently we have a plugin capability for get_relation_info_hook(), but no corresponding capability for statistics info. So, all calls to SearchSysCache would be replaced with a call to get_relation_info_hook(), if present. Any objections, thoughts? -- Simon Riggs www.2ndQuadrant.com

Re: [HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Mark Mielke
Pavel Stehule wrote: 2008/6/26 Marko Kreen <[EMAIL PROTECTED]>: Although now that i read it more, the actual "form" is: ELSE IF THEN END IF END IF; That is - the ELSE starts new block unconditionally and ignores any IF that follows. Later the IF can be part of new block as usual.

Re: [HACKERS] [0/4] Proposal of SE-PostgreSQL patches

2008-06-26 Thread Josh Berkus
Bruce, KaiGai, Is PGACE ready for CommitFest, now? --Josh -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] get_relation_stats_hook()

2008-06-26 Thread Alvaro Herrera
Simon Riggs wrote: > Currently we have a plugin capability for get_relation_info_hook(), but > no corresponding capability for statistics info. > > So, all calls to SearchSysCache would be replaced with a call to > get_relation_info_hook(), if present. I assume you meant get_relation_stats_hook i

Re: [HACKERS] get_relation_stats_hook()

2008-06-26 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > Currently we have a plugin capability for get_relation_info_hook(), but > no corresponding capability for statistics info. > So, all calls to SearchSysCache would be replaced with a call to > get_relation_info_hook(), if present. Surely you didn't mean AL

Re: [HACKERS] Proposal of SE-PostgreSQL patches [try#2]

2008-06-26 Thread KaiGai Kohei
Hi, The following patch set (r926) are updated one toward the latest CVS head, and contains some fixes in security policy and documentation. I want to push them for the reviewing queue of CommitFest:Jul. [1/4] Core facilities of PGACE/SE-PostgreSQL http://sepgsql.googlecode.com/files/sepost

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread David E. Wheeler
On Jun 26, 2008, at 03:28, Martijn van Oosterhout wrote: Hmm, casts to/from text are somewhat "magic" in postgres. They are implemented by calling the usual type input/output function. I have no idea how to extend that to other types. Oh. Okay. Perhaps I won't worry about it just now, then. A

Re: [HACKERS] [0/4] Proposal of SE-PostgreSQL patches

2008-06-26 Thread KaiGai Kohei
Josh Berkus wrote: Bruce, KaiGai, Is PGACE ready for CommitFest, now? --Josh Yes, it's ready now. See the following message: http://archives.postgresql.org/pgsql-hackers/2008-06/msg00980.php http://archives.postgresql.org/pgsql-hackers/2008-06/msg00840.php Thanks, -- KaiGai Kohei <[EMAI

Re: [HACKERS] Regd: TODO Item

2008-06-26 Thread Ramya Chandrasekar
Regd: TODO Item: Optimizer:: Have EXPLAIN ANALYZE issue NOTICE messages when the estimated and actual row counts differ by a specified percentage. Hi, We are a team of two graduate students (volunteers) who plan to work on the above problem from the TODO list of the Optimizer. Being new to P

[HACKERS] proposal: to_ascii(bytea)

2008-06-26 Thread Pavel Stehule
Hello, Changes related to convert* functions in postgresql 8.3 has impact on to_ascii function. Before 8.3 I could do: postgres=# select to_ascii(convert('Příliš žlutý kůň' using utf8_to_iso_8859_2),'latin2'); to_ascii -- Prilis zluty kun (1 row) but convert_to function re

Re: [HACKERS] get_relation_stats_hook()

2008-06-26 Thread Simon Riggs
On Thu, 2008-06-26 at 11:18 -0400, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > > Currently we have a plugin capability for get_relation_info_hook(), but > > no corresponding capability for statistics info. > > > So, all calls to SearchSysCache would be replaced with a call to > >

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread David E. Wheeler
Thanks a million for your answers, Martijn. I just have some more stupid questions, if you could bear with me. On Jun 26, 2008, at 03:28, Martijn van Oosterhout wrote: When creating an index, your comparison functions are going ot be called O(N log N) times. If they leak into a context that i

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Chris Browne
[EMAIL PROTECTED] (Simon Riggs) writes: > On Wed, 2008-06-25 at 23:34 -0400, Robert Haas wrote: >> I can predict that Tom will say that the planning time it would take >> to avoid this problem isn't justified by the number of queries that it >> would improve. > >> That's possible, but it's unfort

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Alvaro Herrera
David E. Wheeler wrote: > The operator functions *do* use PG_FREE_IF_COPY(). So I'm guessing it's > these functions you're talking about. However, my implementation just > looks like this: > > Datum citext_ne (PG_FUNCTION_ARGS) { > // Fast path for different-length inputs. Okay for canonical

Re: [HACKERS] [0/4] Proposal of SE-PostgreSQL patches

2008-06-26 Thread Josh Berkus
KaiGai Kohei wrote: Josh Berkus wrote: Bruce, KaiGai, Is PGACE ready for CommitFest, now? --Josh Yes, it's ready now. OK, added to CommitFest. --Josh -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mail

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Robert Haas
> IMHO we should have a single parameter which indicates how much planning > time we consider acceptable for this query. e.g. > > optimization_level = 2 (default), varies 1-3 > > Most automatic optimisation systems allow this kind of setting, whether > it be a DBMS, or compilers (e.g. gcc). It's

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread David E. Wheeler
On Jun 26, 2008, at 09:19, Alvaro Herrera wrote: PG_GETARG_TEXT_P can detoast the datum, which creates a copy. Thanks. I've just completely refactored things to look more like the approach taken by varlena.c, both in terms of when stuff gets freed and in terms of coding style. It's more ve

Re: [HACKERS] MSVC 2003 compile error with pg8.3.3

2008-06-26 Thread Hiroshi Saito
Hi. Um, Please try this. #include extern void __cdecl _dosmaperr( unsigned long oserrno ); int main(int argc, char *argv[]) { _dosmaperr(GetLastError()); return(0); } Can errorless compile be performed? Regards, Hiroshi Saito - Original Message - From: "Jeff McKenna"

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Simon Riggs
On Thu, 2008-06-26 at 12:36 -0400, Robert Haas wrote: > > IMHO we should have a single parameter which indicates how much planning > > time we consider acceptable for this query. e.g. > > > > optimization_level = 2 (default), varies 1-3 > > > > Most automatic optimisation systems allow this kind

Re: [HACKERS] get_relation_stats_hook()

2008-06-26 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: >> Surely you didn't mean ALL calls. Please be more specific about what >> you're proposing. > The statistics relation STATRELATT is accessed in a few places in the > planner. Since it is in the syscache it is accessed directly from there. > I would like to

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > On Thu, 2008-06-26 at 12:36 -0400, Robert Haas wrote: >> It's my understanding that the philosophy of the PGDG in the past has >> been to avoid putting any kind of hints into the system, focusing >> rather an improving the planning of queries. > It's not a

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Tom Lane
"David E. Wheeler" <[EMAIL PROTECTED]> writes: > Datum citext_ne (PG_FUNCTION_ARGS) { > // Fast path for different-length inputs. Okay for canonical > equivalence? > if (VARSIZE(PG_GETARG_TEXT_P(0)) != VARSIZE(PG_GETARG_TEXT_P(1))) > PG_RETURN_BOOL( 1 ); > PG_RETURN_BOOL(

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread David E. Wheeler
On Jun 26, 2008, at 10:02, Tom Lane wrote: BTW, I don't think you can use that same-length optimization for citext. There's no reason to think that upper/lowercase pairs will have the same length all the time in multibyte encodings. I was wondering about that. I had been thinking of canonical

Re: [HACKERS] Regd: TODO Item

2008-06-26 Thread Tom Lane
"Ramya Chandrasekar" <[EMAIL PROTECTED]> writes: > Regd: TODO Item: Optimizer:: Have EXPLAIN ANALYZE issue NOTICE messages when > the estimated and actual row counts differ by a specified percentage. I think that TODO item hasn't been thought through very carefully. NOTICEs that are dissociated fr

Re: [HACKERS] proposal: to_ascii(bytea)

2008-06-26 Thread Tom Lane
"Pavel Stehule" <[EMAIL PROTECTED]> writes: > Changes related to convert* functions in postgresql 8.3 has impact on > to_ascii function. ISTM to_ascii has a completely bogus API anyway. What is it doing taking an encoding name as an argument? It should just assume the input text is in the databa

Re: [HACKERS] plpgsql: Is ELSE IF supported or not?

2008-06-26 Thread Tom Lane
Mark Mielke <[EMAIL PROTECTED]> writes: > I don't agree with this statement. In "all procedural languages", or > probably most, they usually make "ELSE IF" special, in that you don't > need to close the block twice as per above. The ELSE IF is not actually > special in PL/SQL, so it is not a spe

Re: [HACKERS] Join Removal/ Vertical Partitioning

2008-06-26 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > We can check for removal of a rel by > 1. inspecting the target list for the query to see if there are rels > that do not provide any attributes. (We might also use equivalence > classes to recode the targetlist to minimise the numbers of tables > touched,

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Simon Riggs
On Thu, 2008-06-26 at 12:57 -0400, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > > On Thu, 2008-06-26 at 12:36 -0400, Robert Haas wrote: > >> It's my understanding that the philosophy of the PGDG in the past has > >> been to avoid putting any kind of hints into the system, focusing >

Re: [HACKERS] get_relation_stats_hook()

2008-06-26 Thread Simon Riggs
On Thu, 2008-06-26 at 12:50 -0400, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > >> Surely you didn't mean ALL calls. Please be more specific about what > >> you're proposing. > > > The statistics relation STATRELATT is accessed in a few places in the > > planner. Since it is in th

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Josh Berkus
David, > Thanks. I've just completely refactored things to look more like the > approach taken by varlena.c, both in terms of when stuff gets freed > and in terms of coding style. It's more verbose, but I feel much more > comfortable with memory management now that I'm following a known > implemen

Re: [HACKERS] MSVC 2003 compile error with pg8.3.3

2008-06-26 Thread Jeff McKenna
Hi Hiroshi. What exact file am I to place your test in? win32.h on line#290 ? --- Jeff McKenna FOSS4G Consulting and Training Services http://www.gatewaygeomatics.com/ On 26-Jun-08, at 12:42 PM, Hiroshi Saito wrote: Hi. Um, Please try this. #include extern void __cdecl _dosmaperr( u

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread David E. Wheeler
On Jun 26, 2008, at 12:03, Josh Berkus wrote: Will this be ready for the July CommitFest? When is it due, July 1? If so, yes, it should be. I could use a close review by someone who knows this shit a whole lot better than I do. Thanks, David -- Sent via pgsql-hackers mailing list (pgsql

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Josh Berkus
David, > When is it due, July 1? If so, yes, it should be. I could use a close > review by someone who knows this shit a whole lot better than I do. Well, that's what the commitfest is for. Go ahead and add yourself once you post the new patch. -- Josh Berkus PostgreSQL @ Sun San Francisco -

Re: [HACKERS] MSVC 2003 compile error with pg8.3.3

2008-06-26 Thread Jeff McKenna
For the record, I just compiled libpq.dll successfully with pg8.2.3 and MSVC 2003...so something is causing troubles in pg8.3.3 with this compiler version. Hiroshi let me know where to place that test code, thanks. --- Jeff McKenna FOSS4G Consulting and Training Services http://www.gatew

Re: [HACKERS] Latest on CITEXT 2.0

2008-06-26 Thread Tom Lane
"David E. Wheeler" <[EMAIL PROTECTED]> writes: > So, are your certain about this? See Turkish --- in that locale i and I are not an upper/lower pair, instead they pair with some non-ASCII letters. There are likely other cases but that's the counterexample I remember. rega

Re: [HACKERS] TODO Item: Allow pg_hba.conf to specify host names along with IP addresses

2008-06-26 Thread Josh Berkus
On Wednesday 25 June 2008 17:52, Dickson S. Guedes wrote: > Thanks for all yours suggestions, use cases and opinion about this > thread, I saw that there are more things to consider than I was > thinking and this make me consider that it is a hard work to do for > now. Huh? You should get started

Re: [HACKERS] TODO Item: Allow pg_hba.conf to specify host names along with IP addresses

2008-06-26 Thread Dickson S. Guedes
On Thu, Jun 26, 2008 at 6:04 PM, Josh Berkus <[EMAIL PROTECTED]> wrote: > On Wednesday 25 June 2008 17:52, Dickson S. Guedes wrote: >> Thanks for all yours suggestions, use cases and opinion about this >> thread, I saw that there are more things to consider than I was >> thinking and this make me c

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Ron Mayer
Simon Riggs wrote: IMHO we should have a single parameter which indicates how much planning time we consider acceptable for this query. e.g. optimization_level = 2 (default), varies 1-3 Couldn't the planner itself make a good guess if it should keep trying based on the estimated cost? if (th

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Tom Lane
Ron Mayer <[EMAIL PROTECTED]> writes: > Couldn't the planner itself make a good guess if it should > keep trying based on the estimated cost? > if (the_best_plan_I_found_so_far_looks_like_itll_take_an_hour) >keep_optimizing_for_a_few_minutes > if (the_best_plan_I_found_so_far_looks_like_itll_t

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Ron Mayer
Tom Lane wrote: Ron Mayer <[EMAIL PROTECTED]> writes: Couldn't the planner itself make a good guess if it should keep trying based on the estimated cost? if (the_best_plan_I_found_so_far_looks_like_itll_take_an_hour) keep_optimizing_for_a_few_minutes if (the_best_plan_I_found_so_far_looks_

Re: [HACKERS] Table inheritance surprise

2008-06-26 Thread Bruce Momjian
David Fetter wrote: > Folks, > > When I do CREATE TABLE foo(LIKE bar INCLUDING CONSTRAINTS), it doesn't > include foreign key constraints (8.3.1). I believe this is surprising > behavior, but maybe not a bug, so I'd like to propose another bit of > syntactic sugar, namely > > LIKE [INCLUDING

Re: [HACKERS] CVS Head psql bug?

2008-06-26 Thread Tom Lane
I wrote: > I studied the ld man page for awhile but couldn't find any fix other > than the one Tatsuo suggests of trying to run the linked test program. > That means we have to guess at what to do in a cross-compilation. > I suppose the safest choice is to not try to use --as-needed when > cross-co

[HACKERS] Removal of the patches email list

2008-06-26 Thread Bruce Momjian
We have come to agreement that there is no longer a need for a separate 'patches' email list --- the size of patches isn't a significant issue anymore, and tracking threads between the patches and hackers lists is confusing. I propose we close the patches list and tell everyone to start using only

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Andres Freund
Hi, On Thursday 26 June 2008 04:36:09 Tom Lane wrote: > Andres Freund <[EMAIL PROTECTED]> writes: > > SELECT * > > FROM > > ab LEFT OUTER JOIN ( > > bc JOIN cd > > ON bc.c = cd.d > > ) > > ON ab.b = bc.b > > > > WHERE > > ab.a = 2 > > > > As ab.a = 2

Re: [HACKERS] Planner creating ineffective plans on LEFT OUTER joins

2008-06-26 Thread Tom Lane
Andres Freund <[EMAIL PROTECTED]> writes: >> The only way it could do that would be by interchanging the order of the >> left and inner joins, ie (ab left join bc) join cd; which would change >> the results. > My knowledge about the implementation side of relational databases is quite > limited,

Re: [HACKERS]

2008-06-26 Thread Greg Smith
On Wed, 25 Jun 2008, yuan fang wrote: i am studying the source code of postgresql and want to become a developer of it.What should i do? 1) If you send e-mail to pgsql-hackers, include a useful subject 2) Read the intros at http://www.postgresql.org/developer/ 3) For browsing the code itself

Re: [HACKERS] MSVC 2003 compile error with pg8.3.3

2008-06-26 Thread Hiroshi Saito
Hi Jeff-san. Would you replace this with src/interfaces/libpq/win32.mak and try it? I checked that there was no problem in construction of VC2005 by this change. Then, I think if you solve a problem and it should apply. Regards, Hiroshi Saito - Original Message - From: "Jeff McKenn

Re: [HACKERS] Removal of the patches email list

2008-06-26 Thread Abhijit Menon-Sen
At 2008-06-26 18:51:46 -0400, [EMAIL PROTECTED] wrote: > > I propose we close the patches list and tell everyone to start using > only the hackers list. That's an excellent idea. -- ams -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: h

[HACKERS] Explain XML patch submitted

2008-06-26 Thread raneyt
I just posted a patch addressing the TODO item: "Allow EXPLAIN output to be more easily processed by scripts, perhaps XML" This is a modified patch originally submitted by Germán Poó Caamaño last year. I added the DTD and some other tweaks. I did *not* delve much into the ecpg code, other t