Re: [PATCHES] Snapshot management, final
On Tue, 2008-04-22 at 18:13 -0400, Alvaro Herrera wrote: Simon Riggs wrote: OK, so it can;t be copied to a longer lived memory context? CopySnapshot always copies snapshots to SnapshotContext, which is a context that lives until transaction end. There's no mechanism for copying a snapshot into another context, because I don't see the need. If you need that ability, please explain. No, I wish to prevent that, not enable it. Perhaps put the TransactionId on each snapshot and then an Assert can check it before its used. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 3
Magnus Hagander wrote: This doesn't look like our normal coding standards, and should probably be changed: + if (0 != stat(BACKUP_LABEL_FILE, stat_buf)) (there's a number of similar places) Lacking guidelines, I now tried to copy how stat(2) is used in other parts of the code. Yours, Laurenz Albe backup-shut.doc.patch Description: backup-shut.doc.patch backup-shut.patch Description: backup-shut.patch -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Albe Laurenz wrote: Magnus Hagander wrote: This doesn't look like our normal coding standards, and should probably be changed: + if (0 != stat(BACKUP_LABEL_FILE, stat_buf)) (there's a number of similar places) I see. Lacking guidelines, I now copied how stat(2) is used in other parts of the code. Really? I thought we didn't do that :), and I recall having my own patches bounced for the same reason. Just to be sure, we are talking about the if (0 == foo) vs if (foo == 0) thing, right? If not, then I wasn't clear enough in my note :-( //Magnus -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
[PATCHES] temporal version of generate_series()
I found a TODO item Add temporal versions of generate_series() and wrote patch for generate_series(timestamp, timestamp, interval). I just copied it from int4.c to timestamp.c and fit the data types in timestamp and interval. I wonder if we need ones for timestamptz and time?? If so, the implementation will be so similar that some kind of generic approach should make things smart. For example, find add '+' operator function from syscache and take anyelement as arguments. # This is my first time to send a patch. If I did something wrong, I appreciate your pointing me out. Hitoshi Harada generate_series_timestamp.20080423.patch.gz Description: GNU Zip compressed data -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Snapshot management, final
Simon Riggs wrote: On Tue, 2008-04-22 at 18:13 -0400, Alvaro Herrera wrote: Simon Riggs wrote: OK, so it can;t be copied to a longer lived memory context? If you need that ability, please explain. No, I wish to prevent that, not enable it. I see. Sure, we don't have that problem. In fact, we didn't have it before either, so I'm not sure I see your point :-) Perhaps put the TransactionId on each snapshot and then an Assert can check it before its used. There's no need for that -- all snapshots go away at transaction end. An attempt to use one would cause a prompt crash (at least on an assert-enabled build.) -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Snapshot management, final
Tom Lane wrote: The only reason we have memory contexts at all is to avoid the need to track individual palloc'd objects. Since we're instituting exactly such tracking for snapshots, there's no value in placing them in general-purpose memory contexts. FWIW I noticed yesterday after going to bed that SnapshotContext serves no useful purpose -- we can just remove it and store snaps in TopTransactionContext. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Snapshot management, final
On Wed, 2008-04-23 at 08:21 -0400, Alvaro Herrera wrote: Simon Riggs wrote: On Tue, 2008-04-22 at 18:13 -0400, Alvaro Herrera wrote: Simon Riggs wrote: OK, so it can;t be copied to a longer lived memory context? If you need that ability, please explain. No, I wish to prevent that, not enable it. I see. Sure, we don't have that problem. In fact, we didn't have it before either, so I'm not sure I see your point :-) You originally said because its not needed but didn't explain why. I wanted to make sure there was no loophole. I'm not trying to make any other point, just checking. Forgive me for being dense, but what is there to stop you using a CopySnapshot in TopMemoryContext? If you did, there would be no way to free it, nor would we notice it had been done, AFAICS. Not anything I'm thinking about doing, though. -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Snapshot management, final
Simon Riggs wrote: Forgive me for being dense, but what is there to stop you using a CopySnapshot in TopMemoryContext? If you did, there would be no way to free it, nor would we notice it had been done, AFAICS. Not anything I'm thinking about doing, though. Well, TopMemoryContext is no good because we want to free snapshots in a fell swoop at transaction abort. TopTransactionContext would be OK, as I just said in the parallel subthread. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Albe Laurenz wrote: Magnus Hagander wrote: This doesn't look like our normal coding standards, and should probably be changed: + if (0 != stat(BACKUP_LABEL_FILE, stat_buf)) (there's a number of similar places) I see. Lacking guidelines, I now copied how stat(2) is used in other parts of the code. Applied with some minor changes to the error messages to make them closer to our guidelines. (With my track record, it's not entirely unlikely that someone will fix them further though :-P) //Magnus -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] temporal version of generate_series()
H.Harada escribió: # This is my first time to send a patch. If I did something wrong, I appreciate your pointing me out. Brace positioning is off w.r.t. our conventions -- please fix that and resubmit. I have added this patch to the May commitfest. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Magnus Hagander wrote: Applied with some minor changes to the error messages to make them closer to our guidelines. (With my track record, it's not entirely unlikely that someone will fix them further though :-P) I think the messages should not have a newline in the middle. Also, I am wondering if in PM_WAIT_BACKUP mode we should accept new connections from superusers only. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Alvaro Herrera wrote: Magnus Hagander wrote: Applied with some minor changes to the error messages to make them closer to our guidelines. (With my track record, it's not entirely unlikely that someone will fix them further though :-P) I think the messages should not have a newline in the middle. Are you talking about the one in pg_ctl? We have other messages in pg_ctl that already do this, so I figured it was ok there... Also, I am wondering if in PM_WAIT_BACKUP mode we should accept new connections from superusers only. Oh yeah, bleh, that reminds me that I should send off the couple of comments for further improvements I thought of. One was just this. Another was, should we expose the cancel backup as a SQL level command? //Magnus -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Alvaro Herrera wrote: I think the messages should not have a newline in the middle. Also, I am wondering if in PM_WAIT_BACKUP mode we should accept new connections from superusers only. I spent some thought on that. You'd need to wait until the user is authenticated before you can determine if he/she is a superuser and may connect (otherwise I think it would be a security leak that enables any attacker to find out whether a given user is a superuser without knowing the password). By that time the server process is already forked. I couldn't see a way to check the postmaster state at that point, so I decided not to try and keep it simple. If you have any ideas how I could do such a check reasonably, I'd be happy to try it, because basically I think it would be the right thing. Yours, Laurenz Albe -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Snapshot management, final
Alvaro Herrera wrote: FWIW I noticed yesterday after going to bed that SnapshotContext serves no useful purpose -- we can just remove it and store snaps in TopTransactionContext. ... which is what the attached patch does. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support snapshot-7.patch.bz2 Description: Binary data -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Improve shutdown during online backup, take 4
Magnus Hagander [EMAIL PROTECTED] writes: Alvaro Herrera wrote: I think the messages should not have a newline in the middle. Are you talking about the one in pg_ctl? We have other messages in pg_ctl that already do this, so I figured it was ok there... I concur that the messages added to pg_ctl are bizarrely formatted. Why would you put a newline in the middle of a sentence, when you could equally well emit something like WARNING: online backup mode is active. Shutdown will not complete until pg_stop_backup() is called. While we're on the subject, the messages added to xlog.c do not follow the style guidelines: in particular, errdetail should be a complete sentence, and the WARNING is trying to stuff independent thoughts into one message. I'd probably do errmsg(online backup mode cancelled), errdetail(\%s\ was renamed to \%s\., ... errmsg(online backup mode was not cancelled), errdetail(Failed to rename \%s\ to \%s\: %m, ... Lastly, the changes to pmdie's SIGINT handling seem quite bogus. Don't you need to transition into WAIT_BACKUP rather than WAIT_BACKENDS state in that case too? Shouldn't you do CancelBackup *before* PostmasterStateMachine? The thing screams of race conditions. regards, tom lane -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
[PATCHES] Patch to change psql default banner
Hello, As discussed: http://archives.postgresql.org/pgsql-hackers/2008-04/msg01476.php The patch does the following: Adds an Execution line to the \? output. Changes the help output in mainloop.c to be more useful. Greatly reduces overall default banner output: * shows client version and type help for help only * if server doesn't match shows server version too * if there is a major version mismatch it throws a warning Sincerely, Joshua D. Drake -- The PostgreSQL Company since 1997: http://www.commandprompt.com/ PostgreSQL Community Conference: http://www.postgresqlconference.org/ United States PostgreSQL Association: http://www.postgresql.us/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate ? psql-Log ? psql_patch.diff ? psql_patch_v2.diff ? psql_patch_v3.diff ? psql_patch_v5.diff ? psql_path_v4.diff Index: help.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/help.c,v retrieving revision 1.126 diff -c -r1.126 help.c *** help.c 4 Apr 2008 18:00:25 - 1.126 --- help.c 23 Apr 2008 21:32:20 - *** *** 168,173 --- 168,175 * if this is the start of the string then it ought to end there to fit * in 80 columns */ + fprintf(output, _(Execution\n)); + fprintf(output, _( \\g or ; execute query\n\n)); fprintf(output, _(General\n)); fprintf(output, _( \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n connect to new database (currently \%s\)\n), Index: mainloop.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v retrieving revision 1.90 diff -c -r1.90 mainloop.c *** mainloop.c 5 Apr 2008 03:40:15 - 1.90 --- mainloop.c 23 Apr 2008 21:32:20 - *** *** 177,186 (line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4]))) { free(line); ! puts(_(You are using psql, the command-line interface to PostgreSQL.)); ! puts(_(Enter SQL commands, or type \\? for a list of backslash options.)); ! puts(_(Use \\h for SQL command help.)); ! puts(_(Use \\q to quit.)); fflush(stdout); continue; } --- 177,189 (line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4]))) { free(line); ! puts(_(\n)); ! puts(_(You are using psql, the command-line interface to PostgreSQL.\n)); ! puts(_(\tFor SQL help type \\h or \\help .)); ! puts(_(\tFor help using psql type \\? .)); ! puts(_(\tTo quit psql type \\q .\n)); ! puts(_(\tTo view the copyright type \\copyright .\n)); ! fflush(stdout); continue; } Index: prompt.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/prompt.c,v retrieving revision 1.51 diff -c -r1.51 prompt.c *** prompt.c 1 Jan 2008 19:45:56 - 1.51 --- prompt.c 23 Apr 2008 21:32:20 - *** *** 158,164 /* DB server user name */ case 'n': if (pset.db) ! strlcpy(buf, session_username(), sizeof(buf)); break; case '0': --- 158,164 /* DB server user name */ case 'n': if (pset.db) ! strlcpy(buf, session_username(), sizeof(buf)); break; case '0': Index: startup.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/startup.c,v retrieving revision 1.146 diff -c -r1.146 startup.c *** startup.c 1 Jan 2008 19:45:56 - 1.146 --- startup.c 23 Apr 2008 21:32:20 - *** *** 315,340 server_version = server_ver_str; } ! printf(_(Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n), ! pset.progname, PG_VERSION, server_version); ! } ! else ! printf(_(Welcome to %s %s, the PostgreSQL interactive terminal.\n\n), ! pset.progname, PG_VERSION); ! ! printf(_(Type: \\copyright for distribution terms\n ! \\h for help with SQL commands\n ! \\? for help with psql commands\n ! \\g or terminate with semicolon to execute query\n ! \\q to quit\n\n)); if (pset.sversion / 100 != client_ver / 100) ! printf(_(WARNING: You are connected to a server with major version %d.%d,\n ! but your %s client is major version %d.%d. Some backslash commands,\n ! such as \\d, might not work properly.\n\n), ! pset.sversion / 1, (pset.sversion / 100) % 100, ! pset.progname, ! client_ver / 1, (client_ver / 100) % 100); #ifdef USE_SSL printSSLInfo(); --- 315,333 server_version = server_ver_str; } ! printf(_(\n\t%s %s (server %s)\n\n), ! pset.progname, PG_VERSION, server_version); ! } ! else ! printf(_(%s %s\n\n), !
Re: [PATCHES] Patch to change psql default banner v6
On Wed, 23 Apr 2008 14:41:20 -0700 Joshua D. Drake [EMAIL PROTECTED] wrote: Hello, Per final discussion here: http://archives.postgresql.org/pgsql-hackers/2008-04/msg01607.php Joshua D. Drake -- The PostgreSQL Company since 1997: http://www.commandprompt.com/ PostgreSQL Community Conference: http://www.postgresqlconference.org/ United States PostgreSQL Association: http://www.postgresql.us/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate Index: help.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/help.c,v retrieving revision 1.126 diff -c -r1.126 help.c *** help.c 4 Apr 2008 18:00:25 - 1.126 --- help.c 23 Apr 2008 22:07:24 - *** *** 168,173 --- 168,175 * if this is the start of the string then it ought to end there to fit * in 80 columns */ + fprintf(output, _(Execution\n)); + fprintf(output, _( \\g or ; execute query\n\n)); fprintf(output, _(General\n)); fprintf(output, _( \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n connect to new database (currently \%s\)\n), Index: mainloop.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v retrieving revision 1.90 diff -c -r1.90 mainloop.c *** mainloop.c 5 Apr 2008 03:40:15 - 1.90 --- mainloop.c 23 Apr 2008 22:07:24 - *** *** 177,186 (line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4]))) { free(line); ! puts(_(You are using psql, the command-line interface to PostgreSQL.)); ! puts(_(Enter SQL commands, or type \\? for a list of backslash options.)); ! puts(_(Use \\h for SQL command help.)); ! puts(_(Use \\q to quit.)); fflush(stdout); continue; } --- 177,189 (line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4]))) { free(line); ! puts(_(\n)); ! puts(_(You are using psql, the command-line interface to PostgreSQL.\n)); ! puts(_(\t\\h or \\help for SQL help.)); ! puts(_(\t\\? for psql help.)); ! puts(_(\t\\q to quit psql.\n)); ! puts(_(\t\\copyright to view the copyright.\n)); ! fflush(stdout); continue; } Index: startup.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/startup.c,v retrieving revision 1.146 diff -c -r1.146 startup.c *** startup.c 1 Jan 2008 19:45:56 - 1.146 --- startup.c 23 Apr 2008 22:07:24 - *** *** 315,340 server_version = server_ver_str; } ! printf(_(Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n), ! pset.progname, PG_VERSION, server_version); ! } ! else ! printf(_(Welcome to %s %s, the PostgreSQL interactive terminal.\n\n), ! pset.progname, PG_VERSION); ! ! printf(_(Type: \\copyright for distribution terms\n ! \\h for help with SQL commands\n ! \\? for help with psql commands\n ! \\g or terminate with semicolon to execute query\n ! \\q to quit\n\n)); if (pset.sversion / 100 != client_ver / 100) ! printf(_(WARNING: You are connected to a server with major version %d.%d,\n ! but your %s client is major version %d.%d. Some backslash commands,\n ! such as \\d, might not work properly.\n\n), ! pset.sversion / 1, (pset.sversion / 100) % 100, ! pset.progname, ! client_ver / 1, (client_ver / 100) % 100); #ifdef USE_SSL printSSLInfo(); --- 315,334 server_version = server_ver_str; } ! printf(_(\n\t%s %s (server %s)\n\n), ! pset.progname, PG_VERSION, server_version); ! } ! else ! printf(_(%s %s\n\n), ! pset.progname, PG_VERSION); if (pset.sversion / 100 != client_ver / 100) ! printf(_(\tWARNING: Server version %d.%d, %s version %d.%d.\n ! \tSome psql features may not work.\n\n), ! pset.sversion / 1, (pset.sversion / 100) % 100, ! pset.progname, client_ver / 1, (client_ver / 100) % 100); ! ! printf(_(Type: help for help.\n)); #ifdef USE_SSL printSSLInfo(); -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] temporal version of generate_series()
2008/4/23 Alvaro Herrera [EMAIL PROTECTED]: H.Harada escribió: # This is my first time to send a patch. If I did something wrong, I appreciate your pointing me out. Brace positioning is off w.r.t. our conventions -- please fix that and resubmit. Here's updated version. Thanks for your advice. Hitoshi Harada 2008/4/23 Alvaro Herrera [EMAIL PROTECTED]: H.Harada escribió: # This is my first time to send a patch. If I did something wrong, I appreciate your pointing me out. Brace positioning is off w.r.t. our conventions -- please fix that and resubmit. I have added this patch to the May commitfest. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. generate_series_timestamp.20080424.patch.gz Description: GNU Zip compressed data -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] Patch to change psql default banner v6
Joshua D. Drake wrote: On Wed, 23 Apr 2008 14:41:20 -0700 Joshua D. Drake [EMAIL PROTECTED] wrote: Hello, Per final discussion here: http://archives.postgresql.org/pgsql-hackers/2008-04/msg01607.php Isn't this going to mean \g is listed twice? + fprintf(output, _(Execution\n)); + fprintf(output, _( \\g or ;execute query\n\n)); If you want I can look at reorganizing the \? help. I have a larger reorganization mind. -- Bruce Momjian [EMAIL PROTECTED]http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. + -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches
Re: [PATCHES] lc_time and localized dates
Bruce Momjian wrote: Euler, have you updated this patch yet? Here is an updated patch. It follows the Oracle behaviour and uses a cache mechanism to avoid calling setlocale() all the time. I unified the localized_* and str_* functions. I didn't test it on Windows. I would appreciate some feedback. euler=# select to_char(now(), 'dy tmDy tmDay mon tmMON tmmonth '); to_char --- thu Qui Quinta apr ABR abril 2008 (1 registro) euler=# set lc_time to 'it_IT.UTF-8'; SET euler=# select to_char(now(), 'dy tmDy tmDay mon tmMON tmmonth '); to_char - thu Gio Giovedì apr APR aprile 2008 (1 registro) euler=# set lc_time to 'es_ES.UTF-8'; SET euler=# select to_char(now(), 'dy tmDy tmDay mon tmMON tmmonth '); to_char --- thu Jue Jueves apr ABR abril 2008 (1 registro) euler=# set lc_time to 'fr_FR.UTF-8'; SET euler=# select to_char(now(), 'dy tmDy tmDay mon tmMON tmmonth '); to_char -- thu Jeu Jeudi apr AVR avril 2008 (1 registro) euler=# set lc_time to 'cs_CZ.UTF-8'; SET euler=# select to_char(now(), 'dy tmDy tmDay mon tmMON tmmonth '); to_char --- thu Čt Čtvrtek apr DUB duben 2008 (1 registro) -- Euler Taveira de Oliveira http://www.timbira.com/ l10ntochar.diff.gz Description: GNU Zip compressed data -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches