Re: [pgsql-patches] [PATCHES] Tablespace for temporary objects and sort files
On 1/13/07, Albert Cervera Areny <[EMAIL PROTECTED]> wrote: It was already possible to set the guc on postgresql.conf when I posted the patch... ok... fixed... the problem was that this code only let num_temp_tablespaces be greater than zero when we are in an interactive command (eg. a SET command) but setting the guc from postgresql.conf at startup time is not interactive so num_temp_tablespaces is zero and when i try to get the first temp tablespace to use (MyProcPid % num_temp_tablespaces) causes a floatin exception (division by zero). + if (source >= PGC_S_INTERACTIVE && IsTransactionState()) + { + /* +* Verify that all the names are valid tablspace names +* We do not check for USAGE rights should we? +*/ + foreach(l, namelist) + { + char *curname = (char *) lfirst(l); + + if (get_tablespace_oid(curname) == InvalidOid) + ereport((source == PGC_S_TEST) ? NOTICE : ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("tablespace \"%s\" does not exist", curname))); + + num_temp_tablespaces++; + } + } new patch added, with that piece of code refactored to let num_temp_tablespaces get a value greater than zero always that the guc is setted, i also add some docs. the patch passes all 104 regression tests and all my tests as well... i think the patch is ready to be applied to HEAD, any committer want to review it? -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook Index: doc/src/sgml/config.sgml === RCS file: /projects/cvsroot/pgsql/doc/src/sgml/config.sgml,v retrieving revision 1.101 diff -c -B -b -r1.101 config.sgml *** doc/src/sgml/config.sgml9 Jan 2007 22:16:46 - 1.101 --- doc/src/sgml/config.sgml15 Jan 2007 04:02:13 - *** *** 3398,3403 --- 3398,3432 + + temp_tablespaces (string) + +temp_tablespaces configuration parameter + + tablespacetemp + + + This variable specifies tablespaces in which to create temp + objects (temp tables and indexes on temp tables) when a + CREATE command does not explicitly specify a tablespace + and temp files when necessary (eg. for sorting operations). + + + + The value is either a list of names of tablespaces, or an empty + string to specify using the default tablespace of the current database. + If the value does not match the name of any existing tablespace, + PostgreSQL will automatically use the default + tablespace of the current database. + + + + For more information on tablespaces, + see . + + + + check_function_bodies (boolean) Index: src/backend/commands/indexcmds.c === RCS file: /projects/cvsroot/pgsql/src/backend/commands/indexcmds.c,v retrieving revision 1.152 diff -c -B -b -r1.152 indexcmds.c *** src/backend/commands/indexcmds.c9 Jan 2007 02:14:11 - 1.152 --- src/backend/commands/indexcmds.c15 Jan 2007 04:02:17 - *** *** 209,215 --- 209,221 } else { + /* +* if the target table is temporary then use a temp_tablespace +*/ + if (!rel->rd_istemp) tablespaceId = GetDefaultTablespace(); + else + tablespaceId = GetTempTablespace(); /* note InvalidOid is OK in this case */ } Index: src/backend/commands/tablecmds.c === RCS file: /projects/cvsroot/pgsql/src/backend/commands/tablecmds.c,v retrieving revision 1.210 diff -c -B -b -r1.210 tablecmds.c *** src/backend/commands/tablecmds.c5 Jan 2007 22:19:26 - 1.210 --- src/backend/commands/tablecmds.c15 Jan 2007 04:02:28 - *** *** 334,339 --- 334,343 errmsg("tablespace \"%s\" does not exist", stmt->tablespacename))); } + else if (stmt->relation->istemp) + { + tablespaceId = GetTempTablespace(); + } else { tablespaceId = GetDefaultTablespace(); Index: src/backend/commands/tablespace.c === RCS file: /projects/cvsroot/pgsql/src/backend/commands/tablespace.c,v retriev
Re: [pgsql-patches] [HACKERS] NaN behavior
On Fri, 2007-01-12 at 16:57 -0500, Neil Conway wrote: > I'll apply the attached doc patch to CVS tomorrow, barring any > objections. Applied. -Neil ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [PATCHES] vcbuild optional packages
Marko Kreen wrote: > On 1/14/07, Magnus Hagander <[EMAIL PROTECTED]> wrote: > >Is there any reason why the check is "backwards" in pgcrypto compared to > >the rest of the system? All the other places check for HAVE_ZLIB from > >what I can tell. > > Eh, just an oversight from my part. I was so focused on Makefile > hacking so I forgot to check if there is already a define > somewhere. And its reverse to have less clutter in command-line > in default case. > > Attached patch replaces unnecessary DISABLE_ZLIB define in > pgcrypto with HAVE_LIBZ from core. Result is bit simpler > Makefile which is only good. Applied. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [PATCHES] vcbuild optional packages
On 1/14/07, Magnus Hagander <[EMAIL PROTECTED]> wrote: Is there any reason why the check is "backwards" in pgcrypto compared to the rest of the system? All the other places check for HAVE_ZLIB from what I can tell. Eh, just an oversight from my part. I was so focused on Makefile hacking so I forgot to check if there is already a define somewhere. And its reverse to have less clutter in command-line in default case. Attached patch replaces unnecessary DISABLE_ZLIB define in pgcrypto with HAVE_LIBZ from core. Result is bit simpler Makefile which is only good. -- marko pgcrypto-simpler-zlib.diff Description: Binary data ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [PATCHES] [HACKERS] [Fwd: Index Advisor]
It seems the size restriction has blocked my previous attempt. Please find the first patch attached, and the second one will be in the next mail. Best Regards, -- [EMAIL PROTECTED] [EMAIL PROTECTED] gmail | hotmail | yahoo }.com On 1/13/07, Gurjeet Singh <[EMAIL PROTECTED]> wrote: On 1/9/07, Gurjeet Singh < [EMAIL PROTECTED]> wrote: Now that there's just one call to the Index Adviser (from planner()) we can now move forward in making it a plugin. Hi All, Please find attached two patches: 1) pg_post_planner_plugin-REL8_2_STABLE-v1.patch.gz 2) pg_index_adviser-REL8_2_STABLE-v26.patch.gz Patch 1 introduces the infrastructure to call plugins from the tail-end of the planner() function. The planner looks for a list of PPPFunctions (PostPlannerPluginFunctions) in a rendezvous variable, and then calls the 'driver' callback into the plugin. This patch also adds a new function in explain.c that can be used to generate a string similar to the output of the EXPLAIN command. It also adds a harmless DLLIMPORT to some global variables that were needed by the Index Adviser Plugin. Patch 2 is the plugin version of the Index Adviser and the advise tool. It creates two folders in the contrib module: pg_index_adviser and pg_advise_index. The pg_index_adviser folder contains the updated README. Both the folders contain their respective updated sample_*.[sql|txt] files. Theres one point that needs attention in the patch 1. The code enclosed in GLOBAL_CAND_LIST is a hack, which I couldn't get rid of. In plancat.c we have two options to estimate the number of pages that would be occupied by a virtual index: i) Make a call back into the plugin to get the estimation. The code enabled by GLOBAL_CAND_LIST implements this. ii) We can allow the plugin to update the pg_class.relpages entry for each virtual index, and the planner will pickup the values from there. The code disabled by GLOBAL_CAND_LIST implements this. Option (ii) would be ideal but the core members can be a better judge of this. Is there any other way of doing this? Best regards, -- [EMAIL PROTECTED] [EMAIL PROTECTED] gmail | hotmail | yahoo }.com pg_post_planner_plugin-REL8_2_STABLE-v1.patch.gz Description: GNU Zip compressed data ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
[pgsql-patches] scrollable cursor sup. for SPI
Hello, this patch adds scrollable support functions to SPI. It's necessary for scrollable cursors in plpgsql. Original API is without changes. Regards Pavel Stehule _ Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/ *** ./doc/src/sgml/spi.sgml.orig 2007-01-14 12:37:19.0 +0100 --- ./doc/src/sgml/spi.sgml 2007-01-14 13:42:29.0 +0100 *** *** 1344,1349 --- 1344,1481 + + + SPI_cursor_open_with_options + + + + SPI_cursor_open_with_options + set up a cursor using a plan created with SPI_prepare + + + SPI_cursor_open_with_options + + + + Portal SPI_cursor_open_with_options(const char * name, void * plan, +Datum * values, const char * nulls, +bool read_only, int cursorOptions) + + + + + Description + + +SPI_cursor_open_with_options sets up a cursor (internally, +a portal) that will execute a plan prepared by +SPI_prepare. The parameters have the same +meanings as the corresponding parameters to +SPI_execute_plan. This function allows directly set cursor's +options. + + + +Using a cursor instead of executing the plan directly has two +benefits. First, the result rows can be retrieved a few at a time, +avoiding memory overrun for queries that return many rows. Second, +a portal can outlive the current procedure (it can, in fact, live +to the end of the current transaction). Returning the portal name +to the procedure's caller provides a way of returning a row set as +result. + + + + + Arguments + + + + const char * name + + + name for portal, or NULL to let the system + select a name + + + + + + void * plan + + + execution plan (returned by SPI_prepare) + + + + + + Datum * values + + + An array of actual parameter values. Must have same length as the + plan's number of arguments. + + + + + + const char * nulls + + + An array describing which parameters are null. Must have same length as + the plan's number of arguments. + n indicates a null value (entry in + values will be ignored); a space indicates a + nonnull value (entry in values is valid). + + + + If nulls is NULL then + SPI_cursor_open assumes that no parameters are + null. + + + + + + bool read_only + + + true for read-only execution + + + + + + int cursorOptions + + This option allow to set cursor's options. It's one or combination of + CURSOR_OPT_BINARY, + CURSOR_OPT_SCROLL, + CURSOR_OPT_NO_SCROLL, + CURSOR_OPT_INSENSITIVE, or + CURSOR_OPT_HOLD. + + + + + + + + + Return Value + + +pointer to portal containing the cursor, or NULL +on error + + + + + + SPI_cursor_find *** *** 1472,1477 --- 1604,1685 + + + SPI_scroll_cursor_fetch + + + + SPI_scroll_cursor_fetch + fetch some rows from a scrollable cursor + + + SPI_scroll_cursor_fetch + + + + void SPI_scroll_cursor_fetch(Portal portal, FetchDirection direction, long count) + + + + + Description + + +SPI_scroll_cursor_fetch fetches some rows from a +cursor. This is equivalent to the SQL command FETCH. + + + + + Arguments + + + + Portal portal + + + portal containing the cursor + + + + + + FetchDirection forward + + + It's one from FETCH_FORWARD, + FETCH_BACKWARD, + FETCH_ABSOLUTE or + FETCH_RELATIVE values. Please, look to SQL command FETCH. + + + + + + long count + + + maximum number of rows to fetch. + + + + + + + + Return Value + + +SPI_processed and +SPI_tuptable are set as in +SPI_execute if successful. + + + + + + SPI_cursor_move *** *** 1517,1523 bool forward ! true for move forward, false for move backward --- 1725,1798 bool forward ! true for fetch forward, false for fetch backward ! ! ! ! ! ! long count ! ! ! maximum number of rows to move ! ! ! ! ! ! ! ! ! ! ! ! SPI_scroll_cursor_move ! ! ! ! SPI_scroll_cursor_move ! move a scrollable cursor ! ! ! SPI_scroll_cursor_move ! ! ! ! void SPI_scroll_cursor_move(Portal portal, FetchDirection direction, long count) ! ! ! ! ! Description ! ! !SPI_scroll_cursor_move skips over some number of rows !in a cursor. This is equivalent to the SQL co
Re: [pgsql-patches] [PATCHES] vcbuild optional packages
Marko Kreen wrote: > On 1/8/07, Magnus Hagander <[EMAIL PROTECTED]> wrote: >> This patch fixes vcbuild so you can build without OpenSSL and libz >> should you want to. This disables the sslinfo and pgcrypto modules >> because they require the libraries to build at all. > > Both openssl and zlib are optional for pgcrypto. Please > look at the real Makefile. (Put -DDISABLE_ZLIB into CFLAGS.) > Ah, I see. Will have to take a look at that later then. Is there any reason why the check is "backwards" in pgcrypto compared to the rest of the system? All the other places check for HAVE_ZLIB from what I can tell. //Magnus ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] [PATCHES] vcbuild optional packages
On 1/8/07, Magnus Hagander <[EMAIL PROTECTED]> wrote: This patch fixes vcbuild so you can build without OpenSSL and libz should you want to. This disables the sslinfo and pgcrypto modules because they require the libraries to build at all. Both openssl and zlib are optional for pgcrypto. Please look at the real Makefile. (Put -DDISABLE_ZLIB into CFLAGS.) -- marko ---(end of broadcast)--- TIP 1: 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