Re: [PATCHES] Casting INT4 to BOOL...
Sean Chittenden wrote: Alrighty. Do you want an updated patch for the single character tweak or can you futz with it before committing? :) I oppose casts from boolean to integer or vice versa. Anyway, with Qt, it converts bool values to integers. I think Qt's probably right on this front in that the value 1 should be considered true and 0 should be considered false. My $0.02. -sc That's really Qt's problem. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PATCHES] Casting INT4 to BOOL...
Peter Eisentraut wrote: Sean Chittenden wrote: Alrighty. Do you want an updated patch for the single character tweak or can you futz with it before committing? :) I oppose casts from boolean to integer or vice versa. Even _explicit_ casts only? It would not have any bad side effects on people not using it, would it? Best Regards, Michael Paesold ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [PATCHES] Casting INT4 to BOOL...
Michael Paesold [EMAIL PROTECTED] writes: Peter Eisentraut wrote: I oppose casts from boolean to integer or vice versa. Even _explicit_ casts only? It would not have any bad side effects on people not using it, would it? I agree with Michael's position. I don't like implicit/automatic casts any more than Peter does, but I don't see a strong argument against providing explicit casts. regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] plperl features
I assume this is an 8.0 fix. 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. --- Sergej Sergeev wrote: Sergej Sergeev [EMAIL PROTECTED] writes: What happens if you feed other pseudotypes, like cstring or language_handler? Shouldn't that be disallowed or something? Other pseudo-types are disallowed (no-change) No, because you diked out the check at lines 1452ff, rather than upgrading it to something correct. I find the fn_retispseudo and arg_is_p flags pretty bogus anyway since they fail to indicate *which* pseudotype it is. You might as well just test for the specific type OID. regards, tom lane New patch. I have added the check pseudo-type argumetns. Specific type is substituted in runtime, during function call. -- g.gRay: PL/perl, PL/PHP ;) Index: plperl.c === RCS file: /projects/cvsroot/pgsql-server/src/pl/plperl/plperl.c,v retrieving revision 1.51 diff -c -w -r1.51 plperl.c *** plperl.c 13 Sep 2004 20:08:59 - 1.51 --- plperl.c 30 Sep 2004 16:07:25 - *** *** 82,87 --- 82,89 boollanpltrusted; boolfn_retistuple; /* true, if function returns tuple */ boolfn_retisset;/* true, if function returns set */ + boolfn_retisarray; /* true, if function returns true array*/ + boolfn_retispseudo; /* true, if function returns pseudo type*/ Oid ret_oid;/* Oid of returning type */ FmgrInforesult_in_func; Oid result_typioparam; *** *** 89,94 --- 91,97 FmgrInfoarg_out_func[FUNC_MAX_ARGS]; Oid arg_typioparam[FUNC_MAX_ARGS]; boolarg_is_rowtype[FUNC_MAX_ARGS]; + boolarg_is_p[FUNC_MAX_ARGS]; SV *reference; } plperl_proc_desc; *** *** 277,282 --- 280,319 } /** + * convert perl array to the string representation + **/ + static SV* + plperl_convert_to_pg_array(SV *src) + { + SV* rv; + SV**val;; + AV* internal; + int len, + i; + + internal=(AV*)SvRV(src); + len = av_len(internal)+1; + + rv = newSVpv({ ,0); + for(i=0; ilen; i++) + { + val = av_fetch(internal, i, FALSE); + if (SvTYPE(*val)==SVt_RV) + if (SvTYPE(SvRV(*val))==SVt_PVAV) + sv_catpvf(rv, %s, SvPV(plperl_convert_to_pg_array(*val),PL_na)); + else + elog(ERROR, plperl: check array structure); + else + sv_catpvf(rv, %s, SvPV(*val,PL_na)); + if (i != len-1) sv_catpvf(rv, ,); + } + + sv_catpvf(rv, }); + + return rv; + } + + /** * turn a tuple into a hash expression and add it to a list **/ static void *** *** 752,757 --- 789,807 XPUSHs(sv_2mortal(newSVpv(undef, 0))); for (i = 0; i desc-nargs; i++) { + if (desc-arg_is_p[i]){ + HeapTuple typeTup; + Form_pg_typetypeStruct; + + typeTup = SearchSysCache(TYPEOID, + ObjectIdGetDatum(get_fn_expr_argtype(fcinfo-flinfo, i)), + 0, 0, 0); + typeStruct = (Form_pg_type) GETSTRUCT(typeTup); + perm_fmgr_info(typeStruct-typoutput, (desc-arg_out_func[i])); + desc-arg_typioparam[i] = getTypeIOParam(typeTup); + ReleaseSysCache(typeTup); + } + if (desc-arg_is_rowtype[i]) { if (fcinfo-argnull[i]) *** *** 909,914 --- 959,977 perlret = srf_perlret; } + if (prodesc-fn_retispseudo){ + HeapTuple retTypeTup; + Form_pg_typeretTypeStruct; + + retTypeTup = SearchSysCache(TYPEOID, + ObjectIdGetDatum(get_fn_expr_rettype(fcinfo-flinfo)), + 0, 0,
Re: [PATCHES] plperl features
Bruce Momjian [EMAIL PROTECTED] writes: I assume this is an 8.0 fix. It looks more like a new feature to me ... regards, tom lane ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [PATCHES] Casting INT4 to BOOL...
Is there any reason why the backend doesn't cast an unquoted integer to a boolean value? Hidden cross-category typecasts are evil. I'd accept this as an explicit cast ('e' in pg_cast) but not automatic. Also, what about the other direction? Providing a cast in only one direction is pretty inconsistent. test= SELECT 1::BOOL, 0::BOOL, TRUE::INT4, FALSE::INT4; bool | bool | int4 | int4 --+--+--+-- t| f|1 |0 (1 row) Okey doke, both directions are now provided and the cast has to be explicit. -sc Index: src/backend/utils/adt/int.c === RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/int.c,v retrieving revision 1.63 diff -u -r1.63 int.c --- src/backend/utils/adt/int.c 4 Oct 2004 14:42:46 - 1.63 +++ src/backend/utils/adt/int.c 11 Oct 2004 18:28:41 - @@ -361,6 +361,15 @@ return result; } +Datum +int4_bool(PG_FUNCTION_ARGS) +{ + if (PG_GETARG_INT32(0) == 0) + PG_RETURN_BOOL(false); + else + PG_RETURN_BOOL(true); +} + /* * Index: src/backend/utils/adt/bool.c === RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/bool.c,v retrieving revision 1.35 diff -u -r1.35 bool.c --- src/backend/utils/adt/bool.c29 Aug 2004 05:06:49 - 1.35 +++ src/backend/utils/adt/bool.c11 Oct 2004 18:28:41 - @@ -127,6 +127,18 @@ PG_RETURN_BYTEA_P(pq_endtypsend(buf)); } +/* + * bool_int4 - Casts a boolean to an INT4 + */ +Datum +bool_int4(PG_FUNCTION_ARGS) +{ + if (PG_GETARG_INT32(0) == 0) + PG_RETURN_BOOL(false); + else + PG_RETURN_BOOL(true); +} + /* * PUBLIC ROUTINES * Index: src/include/utils/builtins.h === RCS file: /projects/cvsroot/pgsql/src/include/utils/builtins.h,v retrieving revision 1.251 diff -u -r1.251 builtins.h --- src/include/utils/builtins.h4 Oct 2004 22:49:59 - 1.251 +++ src/include/utils/builtins.h11 Oct 2004 18:28:41 - @@ -76,6 +76,7 @@ extern Datum isnotfalse(PG_FUNCTION_ARGS); extern Datum booland_statefunc(PG_FUNCTION_ARGS); extern Datum boolor_statefunc(PG_FUNCTION_ARGS); +extern Datum bool_int4(PG_FUNCTION_ARGS); /* char.c */ extern Datum charin(PG_FUNCTION_ARGS); @@ -111,6 +112,7 @@ extern Datum i4toi2(PG_FUNCTION_ARGS); extern Datum int2_text(PG_FUNCTION_ARGS); extern Datum text_int2(PG_FUNCTION_ARGS); +extern Datum int4_bool(PG_FUNCTION_ARGS); extern Datum int4_text(PG_FUNCTION_ARGS); extern Datum text_int4(PG_FUNCTION_ARGS); extern Datum int4eq(PG_FUNCTION_ARGS); Index: src/include/catalog/pg_cast.h === RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_cast.h,v retrieving revision 1.16 diff -u -r1.16 pg_cast.h --- src/include/catalog/pg_cast.h 4 Oct 2004 22:49:54 - 1.16 +++ src/include/catalog/pg_cast.h 11 Oct 2004 18:28:41 - @@ -80,6 +80,7 @@ DATA(insert ( 21 700 236 i )); DATA(insert ( 21 701 235 i )); DATA(insert ( 21 1700 1782 i )); +DATA(insert ( 23 16 2557 e )); DATA(insert ( 23 20 481 i )); DATA(insert ( 23 21 314 a )); DATA(insert ( 23 700 318 i )); @@ -381,4 +382,9 @@ DATA(insert ( 1562 1562 1687 i )); DATA(insert ( 1700 1700 1703 i )); +/* + * Misc. coercion functions (ex: bool) + */ +DATA(insert ( 16 23 2558 e )); + #endif /* PG_CAST_H */ Index: src/include/catalog/pg_proc.h === RCS file: /projects/cvsroot/pgsql/src/include/catalog/pg_proc.h,v retrieving revision 1.348 diff -u -r1.348 pg_proc.h --- src/include/catalog/pg_proc.h 7 Oct 2004 18:38:50 - 1.348 +++ src/include/catalog/pg_proc.h 11 Oct 2004 18:28:42 - @@ -3604,6 +3604,11 @@ DATA(insert OID = 2556 ( pg_tablespace_databases PGNSP PGUID 12 f f t t s 1 26 26 _null_ pg_tablespace_databases - _null_)); DESCR(returns database oids in a tablespace); +DATA(insert OID = 2557 ( bool PGNSP PGUID 12 f f t f i 1 16 23 _null_ int4_bool - _null_ )); +DESCR(convert int4 to boolean); +DATA(insert OID = 2558 ( int4 PGNSP PGUID 12 f f t f i 1 23 16 _null_ bool_int4 - _null_ )); +DESCR(convert boolean to int4); + /* * Symbolic values for provolatile column: these indicate whether the result -- Sean Chittenden ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate
Re: [PATCHES] Slightly better testing for pg_ctl(1)'s -w...
pg_ctl(1)'s -w option works well if the default user can automatically authenticate without any user intervention. The attached patch checks the error message to see if it's asking for a password. The theory being that if it's asking for a password, the backend is up. I'm not entirely happy with the fact that I'm dependent on the error message text, but I couldn't easily figure out a better way to test this via libpq(3), so I'm not too unhappy... it's just not elegant. psql and pg_dump test for this same error string, so you're in good company on that front, but password prompting is not the only or even the most likely misleading failure. I believe both the Red Hat and Debian distributions set the default auth method to IDENT, meaning that the message you'd likely get is going to be a bleat about IDENT auth failing, not a password request. Unfortunately that message is going to be localized, but it should have a SQLSTATE assigned, so you could check for ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ... Ok, I've read over the code a little bit... it doesn't seem like there's an obvious way to get the error code via libpq(3). CopyErrorData() looks promising, but I'm running out of time to find a better way to do this. Were you hinting at extending libpq(3) to having the backend send the errcode to the frontend? -sc -- Sean Chittenden ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [PATCHES] plperl features
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: I assume this is an 8.0 fix. It looks more like a new feature to me ... They were requested features that we did not get done before freeze. It would be great if we could get them applied. We are continuing to develop plPerl and at this point, what is going to ship with 8.0 won't even be close to what is available via the plPerl website. We expected this to a degree of course, but if we can get some of them in, it would be nice for the community who wants to use plPerl. Sincerely, Joshua D. Drake regards, tom lane ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL
Re: [PATCHES] Slightly better testing for pg_ctl(1)'s -w...
... it should have a SQLSTATE assigned, so you could check for ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ... Ok, I've read over the code a little bit... it doesn't seem like there's an obvious way to get the error code via libpq(3). Hmmm ... I was thinking of PQresultErrorField, but you don't actually get a PGresult from a connection failure, so that's no good :-(. I suppose we need to think about extending libpq so that a SQLSTATE can be retrieved for connection-level failures. That kinda moves it out of the realm of bug-fix-for-beta though. Whew, glad it wasn't me. Could we (ie Bruce) add getting the raw errcode as an 8.1 TODO item? In the mean time, are you going to commit the pg_ctl patch? -sc -- Sean Chittenden ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [PATCHES] plperl features
Peter Eisentraut wrote: Joshua D. Drake wrote: We expected this to a degree of course, but if we can get some of them in, it would be nice for the community who wants to use plPerl. On the other hand, it wouldn't be that nice for the community that respects a good freeze. As you know, there will always be one more feature. Considering that we're already a long time into the beta phase, and we're still working out portability issues especially in the various plug-ins, we really ought to be strict about the freeze in that area if we ever want to get finished. Agreed. This is the downside of being bundled with the server. Sorry. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [PATCHES] plperl features
Entirely expected (at least by me). I certainly respect a good freeze (what a nice phrase). However, there are outstanding patches from Abhijit Menon-Sen that are genuine bug fixes that need to be queued, reviewed and applied. It was worth a shot ;) Joshua D. Drake cheers andrew ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED]) -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - [EMAIL PROTECTED] - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[PATCHES] libpq.dll on win32
This patch aims to correct the issues with libpq.dll exporting too much on win32. Contains the following changes: * Exports PQgetssl() even if SSL support is not compiled in. In this case, it always returns NULL. This is required so programs that expect SSL version of the library does not crash if they don't get it. * Create a global flag in Makefile.shlib named DLL_DEFNAME used to specify a .def file when generating a DLL. If not specified, falls back to the old behaviour of exporting everything in the file. * Adds required functions to libpqdll.def and libpqddll.def. This includes the functions not in the libpq API that are used by initdb and imported from libpq.dll (per recent mail discussion) //Magnus libpq_def.patch Description: libpq_def.patch ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [PATCHES] plperl features
Andrew Dunstan wrote: Considering that we're already a long time into the beta phase, and we're still working out portability issues especially in the various plug-ins, we really ought to be strict about the freeze in that area if we ever want to get finished. Agreed. This is the downside of being bundled with the server. Sorry. Entirely expected (at least by me). I certainly respect a good freeze (what a nice phrase). However, there are outstanding patches from Abhijit Menon-Sen that are genuine bug fixes that need to be queued, reviewed and applied. Right, I have not gotten to them yet. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [PATCHES] Casting INT4 to BOOL...
Neil Conway [EMAIL PROTECTED] writes: The patch changes the system catalog; it probably ought to also bump the catalog version number. That also means this probably isn't 8.0 material, unless we make an unrelated system catalog change in a future beta (... and even then, I'm not sure if I'd cal it a bug fix). We've already forced an initdb for beta4, so I think any additional reasons for forcing one are free until beta4 goes out. But having said that, this is clearly a feature not a bug. regards, tom lane ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [PATCHES] libpq.dll on win32
Magnus Hagander [EMAIL PROTECTED] writes: *** src/interfaces/libpq/fe-secure.c28 Sep 2004 00:06:02 - 1.54 --- src/interfaces/libpq/fe-secure.c11 Oct 2004 19:50:22 - *** *** 1201,1206 --- 1201,1212 return NULL; return conn-ssl; } + #else + void * + PQgetssl(PGconn *conn) + { + return NULL; + } #endif /* USE_SSL */ This seems like a good idea, but that particular approach to it will draw an unprototyped-global-function warning on every non-SSL-enabled compile ... please clean it up. Also, I count 3 *.def files to be fixed, not two. (We really oughta figure a way to generate them all from a single list file... can we rely on sed(1) being available in all Windows build environments?) regards, tom lane ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [PATCHES] [pgsql-hackers-win32] Static build of libpq fails
Dave Page wrote: Hi, I tried building a static libpq with Mingw, which it seems doesn't work any more: make[3]: *** No rule to make target `libpq.a', needed by `all-static-lib'. Stop. make[3]: Leaving directory `/cvs/pgsql/src/interfaces/libpq' make[2]: *** [all] Error 2 make[2]: Leaving directory `/cvs/pgsql/src/interfaces' make[1]: *** [all] Error 2 make[1]: Leaving directory `/cvs/pgsql/src' make: *** [all] Error 2 I can work around this easily enough, however it should obviously get fixed at some point. I got it working easily by doing 'gmake all-static-lib' from the src/interfaces/libpq directory. Is it supposed to work somewhere else? The attached patch adds some pg_config_paths.h dependencies that are missing. I am now wondering if we should have that file generated by configure, but that defeats the ability to modify Makefile.global to change settings so I guess we are stuck with what we have currently. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 Index: src/Makefile.shlib === RCS file: /cvsroot/pgsql/src/Makefile.shlib,v retrieving revision 1.79 diff -c -c -r1.79 Makefile.shlib *** src/Makefile.shlib 8 Oct 2004 04:22:59 - 1.79 --- src/Makefile.shlib 12 Oct 2004 00:56:46 - *** *** 245,253 all-lib: all-static-lib all-shared-lib ! all-static-lib: lib$(NAME).a ! all-shared-lib: $(shlib) ifneq ($(PORTNAME), cygwin) ifneq ($(PORTNAME), win32) --- 245,253 all-lib: all-static-lib all-shared-lib ! all-static-lib: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h lib$(NAME).a ! all-shared-lib: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h $(shlib) ifneq ($(PORTNAME), cygwin) ifneq ($(PORTNAME), win32) Index: src/interfaces/ecpg/ecpglib/Makefile === RCS file: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v retrieving revision 1.26 diff -c -c -r1.26 Makefile *** src/interfaces/ecpg/ecpglib/Makefile4 Oct 2004 20:36:11 - 1.26 --- src/interfaces/ecpg/ecpglib/Makefile12 Oct 2004 00:56:54 - *** *** 30,36 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \ $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS) ! all: all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib --- 30,36 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \ $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS) ! all: $(top_srcdir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib *** *** 46,51 --- 46,54 exec.c: % : $(top_srcdir)/src/port/% rm -f $@ $(LN_S) $ . + $(top_srcdir)/src/port/pg_config_paths.h: + $(MAKE) -C $(top_srcdir)/src/port pg_config_paths.h + install: all installdirs install-lib installdirs: Index: src/interfaces/libpq/Makefile === RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v retrieving revision 1.115 diff -c -c -r1.115 Makefile *** src/interfaces/libpq/Makefile 6 Oct 2004 16:42:01 - 1.115 --- src/interfaces/libpq/Makefile 12 Oct 2004 00:56:54 - *** *** 31,43 $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS)) ifeq ($(PORTNAME), win32) ! OBJS+=win32.o libpqrc.o ! libpqrc.o: libpq.rc windres -i libpq.rc -o libpqrc.o ifeq ($(enable_thread_safety), yes) # This doesn't work yet because configure test fails. 2004-06-19 ! OBJS+=pthread-win32.o ! PTHREAD_H_WIN32=yes endif endif --- 31,43 $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS)) ifeq ($(PORTNAME), win32) ! OBJS += win32.o libpqrc.o ! libpqrc.o : libpq.rc windres -i libpq.rc -o libpqrc.o ifeq ($(enable_thread_safety), yes) # This doesn't work yet because configure test fails. 2004-06-19 ! OBJS += pthread-win32.o ! PTHREAD_H_WIN32 = yes endif endif *** *** 51,57 endif ! all: $(PTHREAD_H_WIN32) all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib --- 51,57 endif ! all: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib *** *** 83,88 --- 83,91 rm -f $@ $(LN_S) $ . endif + $(top_srcdir)/src/port/pg_config_paths.h: + $(MAKE) -C $(top_srcdir)/src/port pg_config_paths.h + install: all installdirs install-lib
[PATCHES] contrib/xml,xml2 code cleanup
This patch cleans up some unnecessary void * casts in contrib/xml and contrib/xml2. Barring any objections, I intend to apply this to HEAD tomorrow. -Neil Index: contrib/xml/pgxml_dom.c === RCS file: /var/lib/cvs/pgsql/contrib/xml/pgxml_dom.c,v retrieving revision 1.7 diff -c -r1.7 pgxml_dom.c *** contrib/xml/pgxml_dom.c 5 Mar 2004 03:57:58 - 1.7 --- contrib/xml/pgxml_dom.c 12 Oct 2004 01:20:13 - *** *** 47,53 static void pgxml_pfree(void *ptr) { ! return pfree(ptr); } static char * --- 47,53 static void pgxml_pfree(void *ptr) { ! pfree(ptr); } static char * *** *** 216,222 { elog(WARNING, XPath syntax error); xmlFreeDoc(doctree); ! pfree((void *) xpath); xmlCleanupParser(); PG_RETURN_NULL(); } --- 216,222 { elog(WARNING, XPath syntax error); xmlFreeDoc(doctree); ! pfree(xpath); xmlCleanupParser(); PG_RETURN_NULL(); } *** *** 228,234 if (res == NULL) { xmlFreeDoc(doctree); ! pfree((void *) xpath); xmlCleanupParser(); PG_RETURN_NULL(); /* seems appropriate */ } --- 228,234 if (res == NULL) { xmlFreeDoc(doctree); ! pfree(xpath); xmlCleanupParser(); PG_RETURN_NULL(); /* seems appropriate */ } *** *** 258,264 /* Free various storage */ xmlFreeDoc(doctree); ! pfree((void *) xpath); xmlFree(xpresstr); xmlCleanupParser(); PG_RETURN_TEXT_P(xpres); --- 258,264 /* Free various storage */ xmlFreeDoc(doctree); ! pfree(xpath); xmlFree(xpresstr); xmlCleanupParser(); PG_RETURN_TEXT_P(xpres); Index: contrib/xml2/xpath.c === RCS file: /var/lib/cvs/pgsql/contrib/xml2/xpath.c,v retrieving revision 1.3 diff -c -r1.3 xpath.c *** contrib/xml2/xpath.c 29 Aug 2004 05:06:39 - 1.3 --- contrib/xml2/xpath.c 12 Oct 2004 01:26:19 - *** *** 79,85 pgxml_pfree(void *ptr) { /* elog(DEBUG1,Free in CMC %x,CurrentMemoryContext); */ ! return pfree(ptr); } static char * --- 79,85 pgxml_pfree(void *ptr) { /* elog(DEBUG1,Free in CMC %x,CurrentMemoryContext); */ ! pfree(ptr); } static char * *** *** 322,328 toptag, septag, NULL); /* xmlCleanupParser(); done by result_to_text routine */ ! pfree((void *) xpath); if (xpres == NULL) PG_RETURN_NULL(); --- 322,328 toptag, septag, NULL); /* xmlCleanupParser(); done by result_to_text routine */ ! pfree(xpath); if (xpres == NULL) PG_RETURN_NULL(); *** *** 358,364 NULL, NULL, plainsep); /* xmlCleanupParser(); done by result_to_text routine */ ! pfree((void *) xpath); if (xpres == NULL) PG_RETURN_NULL(); --- 358,364 NULL, NULL, plainsep); /* xmlCleanupParser(); done by result_to_text routine */ ! pfree(xpath); if (xpres == NULL) PG_RETURN_NULL(); *** *** 399,405 NULL, NULL, NULL); xmlCleanupParser(); ! pfree((void *) xpath); if (xpres == NULL) PG_RETURN_NULL(); --- 399,405 NULL, NULL, NULL); xmlCleanupParser(); ! pfree(xpath); if (xpres == NULL) PG_RETURN_NULL(); *** *** 429,435 xpath = pgxml_texttoxmlchar(xpathsupp); res = pgxml_xpath(PG_GETARG_TEXT_P(0), xpath); ! pfree((void *) xpath); if (res == NULL) { --- 429,435 xpath = pgxml_texttoxmlchar(xpathsupp); res = pgxml_xpath(PG_GETARG_TEXT_P(0), xpath); ! pfree(xpath); if (res == NULL) { *** *** 469,475 xpath = pgxml_texttoxmlchar(xpathsupp); res = pgxml_xpath(PG_GETARG_TEXT_P(0), xpath); ! pfree((void *) xpath); if (res == NULL) { --- 469,475 xpath = pgxml_texttoxmlchar(xpathsupp); res = pgxml_xpath(PG_GETARG_TEXT_P(0), xpath); ! pfree(xpath); if (res == NULL) { ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[PATCHES] more code cleanup
This patch makes another set of small cosmetic improvements: - remove another senseless extern keyword that was applied to a function definition - change a foo more function signatures from some_type foo() to some_type foo(void) - rewrite another KR style function definition - make the type of the action function pointer in the KeyWord struct in src/backend/utils/adt/formatting.c more precise Barring any objections I intend to apply this to HEAD tomorrow. -Neil Index: src/backend/executor/spi.c === RCS file: /var/lib/cvs/pgsql-server/src/backend/executor/spi.c,v retrieving revision 1.129 diff -c -r1.129 spi.c *** src/backend/executor/spi.c 16 Sep 2004 20:17:20 - 1.129 --- src/backend/executor/spi.c 10 Oct 2004 23:46:10 - *** *** 348,354 * Passing snapshot == InvalidSnapshot will select the normal behavior of * fetching a new snapshot for each query. */ ! extern int SPI_execute_snapshot(void *plan, Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, --- 348,354 * Passing snapshot == InvalidSnapshot will select the normal behavior of * fetching a new snapshot for each query. */ ! int SPI_execute_snapshot(void *plan, Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, *** *** 1629,1641 static MemoryContext ! _SPI_execmem() { return MemoryContextSwitchTo(_SPI_current-execCxt); } static MemoryContext ! _SPI_procmem() { return MemoryContextSwitchTo(_SPI_current-procCxt); } --- 1629,1641 static MemoryContext ! _SPI_execmem(void) { return MemoryContextSwitchTo(_SPI_current-execCxt); } static MemoryContext ! _SPI_procmem(void) { return MemoryContextSwitchTo(_SPI_current-procCxt); } Index: src/backend/port/sysv_shmem.c === RCS file: /var/lib/cvs/pgsql-server/src/backend/port/sysv_shmem.c,v retrieving revision 1.38 diff -c -r1.38 sysv_shmem.c *** src/backend/port/sysv_shmem.c 24 Sep 2004 05:27:35 - 1.38 --- src/backend/port/sysv_shmem.c 10 Oct 2004 23:46:10 - *** *** 143,149 #ifdef EXEC_BACKEND memAddress = shmat(shmid, UsedShmemSegAddr, 0); #else ! memAddress = shmat(shmid, 0, 0); #endif #endif --- 143,149 #ifdef EXEC_BACKEND memAddress = shmat(shmid, UsedShmemSegAddr, 0); #else ! memAddress = shmat(shmid, NULL, 0); #endif #endif Index: src/backend/utils/adt/formatting.c === RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/adt/formatting.c,v retrieving revision 1.78 diff -c -r1.78 formatting.c *** src/backend/utils/adt/formatting.c 30 Aug 2004 02:54:39 - 1.78 --- src/backend/utils/adt/formatting.c 10 Oct 2004 23:46:10 - *** *** 129,151 type; /* prefix / postfix */ } KeySuffix; typedef struct { char *name; /* keyword */ /* action for keyword */ int len, /* keyword length */ ! (*action) (), id;/* keyword id */ bool isitdigit; /* is expected output/input digit */ } KeyWord; ! typedef struct { int type; /* node type */ KeyWord*key; /* if node type is KEYWORD */ int character, /* if node type is CHAR */ suffix; /* keyword suffix */ ! } FormatNode; #define NODE_TYPE_END 1 #define NODE_TYPE_ACTION 2 --- 129,153 type; /* prefix / postfix */ } KeySuffix; + typedef struct FormatNode FormatNode; + typedef struct { char *name; /* keyword */ /* action for keyword */ int len, /* keyword length */ ! (*action) (int arg, char *inout, int suf, int flag, FormatNode *node, void *data), id;/* keyword id */ bool isitdigit; /* is expected output/input digit */ } KeyWord; ! struct FormatNode { int type; /* node type */ KeyWord*key; /* if node type is KEYWORD */ int character, /* if node type is CHAR */ suffix; /* keyword suffix */ ! }; #define NODE_TYPE_END 1 #define NODE_TYPE_ACTION 2 Index: src/backend/utils/mb/mbutils.c === RCS file: /var/lib/cvs/pgsql-server/src/backend/utils/mb/mbutils.c,v retrieving revision 1.47 diff -c -r1.47 mbutils.c *** src/backend/utils/mb/mbutils.c 29 Aug 2004 05:06:51 - 1.47 --- src/backend/utils/mb/mbutils.c 10 Oct 2004 23:46:10 - *** *** 574,580 } void ! SetDefaultClientEncoding() { ClientEncoding = pg_enc2name_tbl[GetDatabaseEncoding()]; } --- 574,580 } void ! SetDefaultClientEncoding(void) { ClientEncoding = pg_enc2name_tbl[GetDatabaseEncoding()]; } Index: src/backend/utils/mb/wstrcmp.c === RCS file:
Re: [PATCHES] Casting INT4 to BOOL...
Is there any reason why the backend doesn't cast an unquoted integer to a boolean value? Can you add some regression tests, please? :-/ I have zero understanding or knowledge of the regression test suite. Given the simplicity of the casts, does this really need a require a regression test? I could've written it as: return(PG_GETARG_INT32(0) ? true : false); and saved a few lines of code... there's no chance or room for a bug or change in behavior unless C changes its trinary operator and that's not gunna happen until hell freezes over and we've all taken up skiing. The patch treats any non-zero value as true. Is that the behavior we want, or should we only allow 1 as an integer representation of true? (I'm not sure myself, I just don't think copying C here is necessarily the best guide.) I would posit that this is the desired behavior as it's consistent with every language I can think of. The patch changes the system catalog; it probably ought to also bump the catalog version number. That also means this probably isn't 8.0 material, unless we make an unrelated system catalog change in a future beta (... and even then, I'm not sure if I'd cal it a bug fix). System catalog bumps have been coming through with some degree of regularity so I wasn't worried about providing the patch to bump the catalog date. -sc -- Sean Chittenden ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [PATCHES] Casting INT4 to BOOL...
Sean Chittenden [EMAIL PROTECTED] writes: Can you add some regression tests, please? Given the simplicity of the casts, does this really need a require a regression test? That request seems quite over-the-top to me too. The real problem here is just whether we want to be accepting a feature addition, small though it be, at this stage of the beta cycle. I've got mixed emotions about that myself. The odds of breaking anything with this patch seem essentially zero, and we have certainly seen this requested multiple times before, so one part of me says sure, push it in. But from a project-management standpoint it's hard to justify not saying it's got to wait for 8.1. The patch treats any non-zero value as true. Is that the behavior we want, or should we only allow 1 as an integer representation of true? (I'm not sure myself, I just don't think copying C here is necessarily the best guide.) I would posit that this is the desired behavior as it's consistent with every language I can think of. I can't see anything wrong with it either. Throwing an error for anything except 0 or 1 would be the other possibility, but that doesn't seem like it really buys anything. The patch changes the system catalog; it probably ought to also bump the catalog version number. System catalog bumps have been coming through with some degree of regularity so I wasn't worried about providing the patch to bump the catalog date. -sc I think the agreed protocol is that the descriptive text should remind the committer to bump the catversion upon application. Just to make sure he doesn't forget ;-) regards, tom lane ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[PATCHES] fix vpath build break
This patch fixes a build break for vpath builds, introduced by Bruce's recent commit. Barring any objections I intend to apply this in a few hours. -Neil Index: src/Makefile.shlib === RCS file: /var/lib/cvs/pgsql/src/Makefile.shlib,v retrieving revision 1.80 diff -c -r1.80 Makefile.shlib *** src/Makefile.shlib 12 Oct 2004 01:04:09 - 1.80 --- src/Makefile.shlib 12 Oct 2004 02:33:31 - *** *** 245,253 all-lib: all-static-lib all-shared-lib ! all-static-lib: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h lib$(NAME).a ! all-shared-lib: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h $(shlib) ifneq ($(PORTNAME), cygwin) ifneq ($(PORTNAME), win32) --- 245,253 all-lib: all-static-lib all-shared-lib ! all-static-lib: $(PTHREAD_H_WIN32) $(top_builddir)/src/port/pg_config_paths.h lib$(NAME).a ! all-shared-lib: $(PTHREAD_H_WIN32) $(top_builddir)/src/port/pg_config_paths.h $(shlib) ifneq ($(PORTNAME), cygwin) ifneq ($(PORTNAME), win32) Index: src/interfaces/ecpg/ecpglib/Makefile === RCS file: /var/lib/cvs/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v retrieving revision 1.27 diff -c -r1.27 Makefile *** src/interfaces/ecpg/ecpglib/Makefile 12 Oct 2004 01:04:10 - 1.27 --- src/interfaces/ecpg/ecpglib/Makefile 12 Oct 2004 02:32:18 - *** *** 30,36 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \ $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS) ! all: $(top_srcdir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib --- 30,36 SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \ $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS) ! all: $(top_builddir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib Index: src/interfaces/libpq/Makefile === RCS file: /var/lib/cvs/pgsql/src/interfaces/libpq/Makefile,v retrieving revision 1.116 diff -c -r1.116 Makefile *** src/interfaces/libpq/Makefile 12 Oct 2004 01:04:11 - 1.116 --- src/interfaces/libpq/Makefile 12 Oct 2004 02:31:51 - *** *** 51,57 endif ! all: $(PTHREAD_H_WIN32) $(top_srcdir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib --- 51,57 endif ! all: $(PTHREAD_H_WIN32) $(top_builddir)/src/port/pg_config_paths.h all-lib # Shared library stuff include $(top_srcdir)/src/Makefile.shlib ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [PATCHES] Casting INT4 to BOOL...
On Mon, 11 Oct 2004, Sean Chittenden wrote: The patch treats any non-zero value as true. Is that the behavior we want, or should we only allow 1 as an integer representation of true? (I'm not sure myself, I just don't think copying C here is necessarily the best guide.) I would posit that this is the desired behavior as it's consistent with every language I can think of. However, AFAIK it's inconsitent with the type input function which supports '1' and '0' but not other integers. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] Casting INT4 to BOOL...
Stephan Szabo [EMAIL PROTECTED] writes: On Mon, 11 Oct 2004, Sean Chittenden wrote: I would posit that this is the desired behavior as it's consistent with every language I can think of. However, AFAIK it's inconsitent with the type input function which supports '1' and '0' but not other integers. So? The type input function also accepts 't', 'f', and other spellings that are not in the input domain for an integer-to-bool coercion. Will you argue we should remove those allowed inputs so that it can be 100% compatible with the coercion? The question for an integer-to-bool conversion is what is useful and expected behavior for that conversion; I don't think that's necessarily the same as what the textual conversion should do. A possibly useful analogy is that real-to-integer coercion rounds off fractions; it doesn't error out, even though the integer input function won't take a string that includes a decimal point. To pollute this abstract discussion with an actual fact ;-) ... I note from recent discussion on the ODBC list that M$ Access likes to use -1 to represent TRUE. So it would certainly make life easier for Access migrants if the int-to-bool coercion would accept -1. regards, tom lane ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [PATCHES] Casting INT4 to BOOL...
On Tue, 2004-10-12 at 11:54, Sean Chittenden wrote: :-/ I have zero understanding or knowledge of the regression test suite. It is trivial: add some SQL to src/test/regress/sql/foo.sql, run the tests, hand-verify the output (e.g. by looking at regression.diffs), and then copy the updated output from src/test/regress/results to src/test/regress/expected Given the simplicity of the casts, does this really need a require a regression test? Yeah, I suppose not. Personally I'd always err on the side of doing more testing rather than less (I don't see much point in striving for minimalism in a test suite), but you're right that this functionality is probably sufficiently trivial it doesn't need tests. -Neil ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PATCHES] fix vpath build break
On Tue, 2004-10-12 at 12:37, Neil Conway wrote: This patch fixes a build break for vpath builds, introduced by Bruce's recent commit. Applied to HEAD. -Neil ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] [PATCHES] HP-UX PA-RISC/Itanium 64-bit Patch and HP-UX
On Fri, 08 Oct 2004 00:26:06 -0400, Tom Lane [EMAIL PROTECTED] said: Shinji Teragaito [EMAIL PROTECTED] writes: 152c152 SHLIB_LINK += `$(CC) -print-libgcc-file-name` --- SHLIB_LINK += `$(CC) $(LDFLAGS) -print-libgcc-file-name` Okay. I'm slightly worried about odd LDFLAGS values confusing this, but we can deal with that when we see an example. 155c155 LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) --- LINK.shared = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) -Wl,+b -Wl,$(libdir) That looks good too. I think I had seen a truncated version of this (just the +b part) and left it off because it didn't work. I've applied both these changes. Thank you !! 58c58 ifeq ($(with_gnu_ld), yes) --- ifeq ($(GCC), yes) This I cannot apply; it breaks the gcc-with-HP-ld case, at least on my personal installation (HPUX 10.20, gcc 2.95.3, HP ld). My tests on HP's testdrive systems did not show any problem here --- what case are you concerned about exactly? gcc-with-HP-ld case on Itanium (HP-UX 11.23, gcc 3.4.1, HP ld). Cheers, Shinji Teragaito Hewlett-Packard Japan, Ltd. ---(end of broadcast)--- TIP 8: explain analyze is your friend