Re: port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
Bruce Momjian writes: > Tom Lane wrote: >> Done ... let me know whether the back branches still pass regression >> for you ;-) > I checked back to 7.3 and everything passed. I did a cvs update, > configure, gmake, and regression run for each branch. [ digs a bit deeper... ] Actually, it appears that that bug didn't exist before 8.1; it was introduced here: 2005-03-16 22:18 momjian * src/port/snprintf.c: Factor duplicate snprintf code into functions. by an ill-considered removal of an unsigned local variable. regards, tom lane ---(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: port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
Tom Lane wrote: > I wrote: > > Hm. One of the main problems I found was incorrect results for > > LONGLONG_MIN (-2^63). I'm rather tempted to add a test case for > > that to the int8 regression test and see if any platforms fail ;-) > > Done ... let me know whether the back branches still pass regression > for you ;-) I checked back to 7.3 and everything passed. I did a cvs update, configure, gmake, and regression run for each branch. -- Bruce Momjian| http://candle.pha.pa.us pgman@candle.pha.pa.us | (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: explain analyze is your friend
Re: [PATCHES] psql, tab completion additions
Previous version replaced. 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. --- Sergey E. Koposov wrote: > > Now the patch have been made using "cvs diff -c" > > Sergey > > On Tue, 29 Nov 2005, Sergey E. Koposov wrote: > > > Hello All, > > > > 1) I'm proposing a patch to do the DROP FUNCTION argument tab completion. > > Now, the arguments of the drop function can be tab completed. for example > > > > drop function strpos ( > > > > drop FUNCTION strpos (text, text) > > > > or: > > > > wsdb=# drop FUNCTION length ( > > bit)bytea) character) lseg) path) text) > > > > wsdb# DROP FUNCTION length ( character) > > > > I think that this patch should be rather useful. At it least I hate > > always to type all the arguments of the dropped functions. > > > > 2) Also some fixes applied for the > > CREATE INDEX syntax > > > > now the parenthesises are inserted by tab pressing. > > suppose I have the table q3c: > > wsdb=# \d q3c > > Table "public.q3c" > > Column | Type | Modifiers > > +--+--- > > ipix | bigint | > > ra | double precision | > > dec| double precision | > > > > Now if I do > > wsdb# create index xxx on q3c > > > > wsdb# CREATE INDEX xxx on q3c ( > > > > wsdb=# CREATE INDEX xxx on q3c ( > > "dec" ipix ra > > > > wsdb=# CREATE INDEX xxx on q3c ( ra > > > > Regards, > > Sergey > > > > * > > Sergey E. Koposov > > Max-Planck Institut for Astronomy > > Web: http://lnfm1.sai.msu.ru/~math > > E-mail: [EMAIL PROTECTED] > > > > > > * > Sergey E. Koposov > Max-Planck Institut for Astronomy > Web: http://lnfm1.sai.msu.ru/~math > E-mail: [EMAIL PROTECTED] > Content-Description: [ Attachment, skipping... ] > > ---(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 -- Bruce Momjian| http://candle.pha.pa.us pgman@candle.pha.pa.us | (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 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: [PATCHES] psql, tab completion additions
Now the patch have been made using "cvs diff -c" Sergey On Tue, 29 Nov 2005, Sergey E. Koposov wrote: > Hello All, > > 1) I'm proposing a patch to do the DROP FUNCTION argument tab completion. > Now, the arguments of the drop function can be tab completed. for example > > drop function strpos ( > > drop FUNCTION strpos (text, text) > > or: > > wsdb=# drop FUNCTION length ( > bit)bytea) character) lseg) path) text) > > wsdb# DROP FUNCTION length ( character) > > I think that this patch should be rather useful. At it least I hate > always to type all the arguments of the dropped functions. > > 2) Also some fixes applied for the > CREATE INDEX syntax > > now the parenthesises are inserted by tab pressing. > suppose I have the table q3c: > wsdb=# \d q3c > Table "public.q3c" > Column | Type | Modifiers > +--+--- > ipix | bigint | > ra | double precision | > dec| double precision | > > Now if I do > wsdb# create index xxx on q3c > > wsdb# CREATE INDEX xxx on q3c ( > > wsdb=# CREATE INDEX xxx on q3c ( > "dec" ipix ra > > wsdb=# CREATE INDEX xxx on q3c ( ra > > Regards, > Sergey > > * > Sergey E. Koposov > Max-Planck Institut for Astronomy > Web: http://lnfm1.sai.msu.ru/~math > E-mail: [EMAIL PROTECTED] > > * Sergey E. Koposov Max-Planck Institut for Astronomy Web: http://lnfm1.sai.msu.ru/~math E-mail: [EMAIL PROTECTED] Index: tab-complete.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/tab-complete.c,v retrieving revision 1.141 diff -c -r1.141 tab-complete.c *** tab-complete.c 18 Nov 2005 16:31:11 - 1.141 --- tab-complete.c 5 Dec 2005 04:14:43 - *** *** 476,481 --- 476,483 static char *previous_word(int point, int skip); + static int find_open_parenthesis(int end); + #if 0 static char *quote_file_name(char *text, int match_type, char *quote_pointer); static char *dequote_file_name(char *text, char quote_char); *** *** 1016,1022 */ else if (pg_strcasecmp(prev4_wd, "INDEX") == 0 && pg_strcasecmp(prev2_wd, "ON") == 0) ! COMPLETE_WITH_ATTR(prev_wd); /* same if you put in USING */ else if (pg_strcasecmp(prev4_wd, "ON") == 0 && pg_strcasecmp(prev2_wd, "USING") == 0) --- 1018,1040 */ else if (pg_strcasecmp(prev4_wd, "INDEX") == 0 && pg_strcasecmp(prev2_wd, "ON") == 0) ! { ! if (find_open_parenthesis(end)) ! { ! COMPLETE_WITH_ATTR(prev_wd); ! } ! else ! { ! COMPLETE_WITH_CONST("("); ! } ! } ! else if (pg_strcasecmp(prev5_wd, "INDEX") == 0 && ! pg_strcasecmp(prev3_wd, "ON") == 0 && ! pg_strcasecmp(prev_wd, "(") == 0) ! { ! COMPLETE_WITH_ATTR(prev2_wd); ! } ! /* same if you put in USING */ else if (pg_strcasecmp(prev4_wd, "ON") == 0 && pg_strcasecmp(prev2_wd, "USING") == 0) *** *** 1222,1233 pg_strcasecmp(prev3_wd, "AGGREGATE") == 0 && prev_wd[strlen(prev_wd) - 1] == ')')) { ! static const char *const list_DROPCR[] = ! {"CASCADE", "RESTRICT", NULL}; ! ! COMPLETE_WITH_LIST(list_DROPCR); } /* EXPLAIN */ /* --- 1240,1282 pg_strcasecmp(prev3_wd, "AGGREGATE") == 0 && prev_wd[strlen(prev_wd) - 1] == ')')) { ! ! if ((pg_strcasecmp(prev3_wd, "DROP") == 0) && (pg_strcasecmp(prev2_wd, "FUNCTION") == 0)) ! { ! if (find_open_parenthesis(end)) ! { ! static const char func_args_query[] = "select pg_catalog.oidvectortypes(proargtypes)||')' from pg_proc where proname='%s'"; ! char *tmp_buf = malloc(strlen(func_args_query) + strlen(prev_wd)); ! sprintf(tmp_buf, func_args_query, prev_wd); ! COMPLETE_WITH_QUERY(tmp_buf); ! free(tmp_buf); ! } ! else ! { ! COMPLETE_WITH_CONST("("); ! } ! } ! else ! { ! static const char *const list_DROPCR[] = ! {"CASCA
Re: port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
I wrote: > Hm. One of the main problems I found was incorrect results for > LONGLONG_MIN (-2^63). I'm rather tempted to add a test case for > that to the int8 regression test and see if any platforms fail ;-) Done ... let me know whether the back branches still pass regression for you ;-) regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [PATCHES] TODO item -- Improve psql's handling of multi-line
On Sun, 4 Dec 2005, Bruce Momjian wrote: > > Can I have this patch in diff -c? The format you used isn't reliable > for patching. Thanks. Sorry, I didn't know that the patch should be done with "-c". Ok, now I'm sending it diff -c Regards, Sergey > > --- > > Sergey E. Koposov wrote: > > Hello, > > > > Sorry for not quick problem fixing, I was quite busy last time... > > > > I submit the new version of my patch (against the CVS tip), correcting the > > problem with \edit (pointed by Andreas). So now everything works fine. > > > > With Best Regards, > > > > Sergey > > > > > > > > On Thu, 1 Dec 2005, Bruce Momjian wrote: > > > > > > > > Where are we on this patch? Was it submitted? Applied? Just an idea? > > > > > > --- > > > > > > Andreas Seltenreich wrote: > > > > Sergey E. Koposov writes: > > > > > > > > > I'm proposing the small patch for the TODO item -- Improve psql's > > > > > handling > > > > > of multi-line queries. With this patch the multi-line queries are > > > > > saved > > > > > by readline as whole and not line by line. > > > > > > > > I like it already! > > > > > > > > > This is my first patch for Postgres but it seems to work and to not > > > > > break > > > > > anything. > > > > > > > > > > I'm waiting for review, comments, objections, etc... > > > > > > > > Did you consider its interaction with \e? Editing the query_buffer > > > > with \e will leave that query prefixed with \e in the history. That > > > > wasn't the case before your patch. > > > > > > > > Also, using \e several times on a query without sending it (i.e. > > > > without a semicolon) will yield a history entry of a concatenation of > > > > old query buffers. > > > > > > > > Thanks, > > > > Andreas > > > > > > > > ---(end of broadcast)--- > > > > TIP 4: Have you searched our list archives? > > > > > > > >http://archives.postgresql.org > > > > > > > > > > > > > > > > * > > Sergey E. Koposov > > Max-Planck Institut for Astronomy > > Web: http://lnfm1.sai.msu.ru/~math > > E-mail: [EMAIL PROTECTED] > > > > Content-Description: > > [ Attachment, skipping... ] > > * Sergey E. Koposov Max-Planck Institut for Astronomy Web: http://lnfm1.sai.msu.ru/~math E-mail: [EMAIL PROTECTED] Index: input.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/input.c,v retrieving revision 1.46 diff -c -r1.46 input.c *** input.c 15 Oct 2005 02:49:40 - 1.46 --- input.c 5 Dec 2005 04:07:32 - *** *** 90,106 #ifdef USE_READLINE char *s; - static char *prev_hist = NULL; - if (useReadline) /* On some platforms, readline is declared as readline(char *) */ s = readline((char *) prompt); else s = gets_basic(prompt); ! if (useHistory && s && s[0]) { enum histcontrol HC; HC = GetHistControlConfig(); --- 90,155 #ifdef USE_READLINE char *s; if (useReadline) /* On some platforms, readline is declared as readline(char *) */ s = readline((char *) prompt); else s = gets_basic(prompt); ! return s; ! #else ! return gets_basic(prompt); ! #endif ! } ! ! /* Put the line in the history buffer and also add the trailing \n */ ! char *pgadd_history(char *s, char *history_buf, int *cur_len) ! { ! #ifdef USE_READLINE ! ! int slen; ! char *history_buf1 = 0; ! if (useReadline && useHistory && s && s[0]) { + slen = strlen(s); + history_buf1 = history_buf; + history_buf1 = realloc(history_buf1, (*cur_len + slen + 2) * sizeof(char)); + strcpy(history_buf1 + *cur_len, s); + if (s[slen-1]!='\n') + { + *cur_len += (slen + 1); + history_buf1[*cur_len - 1] = '\n'; + history_buf1[*cur_len] = 0; + } + else + { + *cur_len += (slen); + history_buf1[*cur_len] = 0; + } + + } + return history_buf1; + #endif + } + + /* Feed the contents of the history buffer to readline */ + void pgflush_history(char **history_buf, int *cur_len) + { + + #ifdef USE_READLINE + + char *s; + static char *prev_hist; + + if (useReadline && useHistory && ((*cur_len) > 0)) + { + enum histcontrol HC; + + s
Re: port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
Tom Lane wrote: > Bruce Momjian writes: > > OK, snprintf.c fixed. I added a 'stream' and outlen parameter to all > > the calls, and cleaned up the switch() statement that was outputing > > twice. When we were outputing just to a string, it didn't matter, but > > now that we are also outputting to a stream, it does. > > I found a whole bunch more problems than this :-(. I've committed a > cleaned-up version that seems to work correctly in a simple standalone > testbed, but it'd be a good idea to exercise it inside PG as well. > Can you try regression tests and the factorial() problem on CVS tip? Thanks. Tested 8.1.1 and CVS tip and all compile, and regression pass. I also tested the factorial test and the result looks perfect, thanks! > The problems are sufficiently bad that it might be a good idea to > backport the fixes into 8.0 and before as well --- but I note that > the ABI is different (pg_snprintf vs snprintf, etc) so this requires > a bit of investigation rather than just committing the file as-is. Not as many 8.0.X platforms used *printf because we didn't test %$ for its use on that release, so my bet is that very few platforms would be using it. -- Bruce Momjian| http://candle.pha.pa.us pgman@candle.pha.pa.us | (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: 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: port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
Bruce Momjian writes: > Tom Lane wrote: >> The problems are sufficiently bad that it might be a good idea to >> backport the fixes into 8.0 and before as well --- but I note that >> the ABI is different (pg_snprintf vs snprintf, etc) so this requires >> a bit of investigation rather than just committing the file as-is. > Not as many 8.0.X platforms used *printf because we didn't test %$ for > its use on that release, so my bet is that very few platforms would be > using it. Hm. One of the main problems I found was incorrect results for LONGLONG_MIN (-2^63). I'm rather tempted to add a test case for that to the int8 regression test and see if any platforms fail ;-) regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [PATCHES] TODO item -- Improve psql's handling of multi-line queries
Can I have this patch in diff -c? The format you used isn't reliable for patching. Thanks. --- Sergey E. Koposov wrote: > Hello, > > Sorry for not quick problem fixing, I was quite busy last time... > > I submit the new version of my patch (against the CVS tip), correcting the > problem with \edit (pointed by Andreas). So now everything works fine. > > With Best Regards, > > Sergey > > > > On Thu, 1 Dec 2005, Bruce Momjian wrote: > > > > > Where are we on this patch? Was it submitted? Applied? Just an idea? > > > > --- > > > > Andreas Seltenreich wrote: > > > Sergey E. Koposov writes: > > > > > > > I'm proposing the small patch for the TODO item -- Improve psql's > > > > handling > > > > of multi-line queries. With this patch the multi-line queries are saved > > > > by readline as whole and not line by line. > > > > > > I like it already! > > > > > > > This is my first patch for Postgres but it seems to work and to not > > > > break > > > > anything. > > > > > > > > I'm waiting for review, comments, objections, etc... > > > > > > Did you consider its interaction with \e? Editing the query_buffer > > > with \e will leave that query prefixed with \e in the history. That > > > wasn't the case before your patch. > > > > > > Also, using \e several times on a query without sending it (i.e. > > > without a semicolon) will yield a history entry of a concatenation of > > > old query buffers. > > > > > > Thanks, > > > Andreas > > > > > > ---(end of broadcast)--- > > > TIP 4: Have you searched our list archives? > > > > > >http://archives.postgresql.org > > > > > > > > > > * > Sergey E. Koposov > Max-Planck Institut for Astronomy > Web: http://lnfm1.sai.msu.ru/~math > E-mail: [EMAIL PROTECTED] > Content-Description: [ Attachment, skipping... ] -- Bruce Momjian| http://candle.pha.pa.us pgman@candle.pha.pa.us | (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: explain analyze is your friend
port/snprintf.c (was Re: [PATCHES] Numeric 508 datatype)
Bruce Momjian writes: > OK, snprintf.c fixed. I added a 'stream' and outlen parameter to all > the calls, and cleaned up the switch() statement that was outputing > twice. When we were outputing just to a string, it didn't matter, but > now that we are also outputting to a stream, it does. I found a whole bunch more problems than this :-(. I've committed a cleaned-up version that seems to work correctly in a simple standalone testbed, but it'd be a good idea to exercise it inside PG as well. Can you try regression tests and the factorial() problem on CVS tip? The problems are sufficiently bad that it might be a good idea to backport the fixes into 8.0 and before as well --- but I note that the ABI is different (pg_snprintf vs snprintf, etc) so this requires a bit of investigation rather than just committing the file as-is. regards, tom lane ---(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
Re: [PATCHES] French po files
Le Dimanche 04 Décembre 2005 20:59, Alvaro Herrera a écrit : > Guillaume LELARGE wrote: > > Here is an update to french po files for 7.4 and 8.0 branches. Please > > apply them to their respective branches. > > > > Peter, is there a way to commit them via the pgtranslation project ? > > Sure -- join the project first, then someone makes you a developer, and > then you can commit there. This someone is probably Peter, though I > could do it if he's not available. I'm already registered as a developer on this project. Thanks for your answer. -- Guillaume. ---(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
Re: [PATCHES] French po files
Guillaume LELARGE wrote: > Here is an update to french po files for 7.4 and 8.0 branches. Please > apply them to their respective branches. > > Peter, is there a way to commit them via the pgtranslation project ? Yes, I just finished organizing this today. You can check out branches like REL7_4_STABLE and REL8_0_STABLE from that repository and check in your things there. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(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: [PATCHES] French po files
Guillaume LELARGE wrote: > Hi, > > Here is an update to french po files for 7.4 and 8.0 branches. Please apply > them to their respective branches. > > Peter, is there a way to commit them via the pgtranslation project ? Sure -- join the project first, then someone makes you a developer, and then you can commit there. This someone is probably Peter, though I could do it if he's not available. -- 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: [PATCHES] TODO item -- Improve psql's handling of multi-line
Hello, Sorry for not quick problem fixing, I was quite busy last time... I submit the new version of my patch (against the CVS tip), correcting the problem with \edit (pointed by Andreas). So now everything works fine. With Best Regards, Sergey On Thu, 1 Dec 2005, Bruce Momjian wrote: > > Where are we on this patch? Was it submitted? Applied? Just an idea? > > --- > > Andreas Seltenreich wrote: > > Sergey E. Koposov writes: > > > > > I'm proposing the small patch for the TODO item -- Improve psql's > > > handling > > > of multi-line queries. With this patch the multi-line queries are saved > > > by readline as whole and not line by line. > > > > I like it already! > > > > > This is my first patch for Postgres but it seems to work and to not break > > > anything. > > > > > > I'm waiting for review, comments, objections, etc... > > > > Did you consider its interaction with \e? Editing the query_buffer > > with \e will leave that query prefixed with \e in the history. That > > wasn't the case before your patch. > > > > Also, using \e several times on a query without sending it (i.e. > > without a semicolon) will yield a history entry of a concatenation of > > old query buffers. > > > > Thanks, > > Andreas > > > > ---(end of broadcast)--- > > TIP 4: Have you searched our list archives? > > > >http://archives.postgresql.org > > > > * Sergey E. Koposov Max-Planck Institut for Astronomy Web: http://lnfm1.sai.msu.ru/~math E-mail: [EMAIL PROTECTED] Index: input.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/input.c,v retrieving revision 1.46 diff -r1.46 input.c 93,94d92 < static char *prev_hist = NULL; < 101c99,112 < if (useHistory && s && s[0]) --- > return s; > #else > return gets_basic(prompt); > #endif > } > > /* Put the line in the history buffer and also add the trailing \n */ > char *pgadd_history(char *s, char *history_buf, int *cur_len) > { > #ifdef USE_READLINE > > int slen; > char *history_buf1 = 0; > if (useReadline && useHistory && s && s[0]) 102a114,146 > slen = strlen(s); > history_buf1 = history_buf; > history_buf1 = realloc(history_buf1, (*cur_len + slen + 2) * > sizeof(char)); > strcpy(history_buf1 + *cur_len, s); > if (s[slen-1]!='\n') > { > *cur_len += (slen + 1); > history_buf1[*cur_len - 1] = '\n'; > history_buf1[*cur_len] = 0; > } > else > { > *cur_len += (slen); > history_buf1[*cur_len] = 0; > } > > } > return history_buf1; > #endif > } > > /* Feed the contents of the history buffer to readline */ > void pgflush_history(char **history_buf, int *cur_len) > { > > #ifdef USE_READLINE > > char *s; > static char *prev_hist; > > if (useReadline && useHistory && ((*cur_len) > 0)) > { > 103a148,152 > > s = *history_buf; > prev_hist = NULL; > > s[(*cur_len) - 1] = 0; 117a167,170 > > free(s); > *history_buf = 0; > *cur_len = 0; 119,122d171 < < return s; < #else < return gets_basic(prompt); 124d172 < } 125a174 > } Index: input.h === RCS file: /projects/cvsroot/pgsql/src/bin/psql/input.h,v retrieving revision 1.23 diff -r1.23 input.h 41a42,44 > char *pgadd_history(char *s, char *history_buf, int *cur_len); > void pgflush_history(char **history_buf, int *cur_len); > Index: mainloop.c === RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v retrieving revision 1.68 diff -r1.68 mainloop.c 40a41,42 > char*history_buf = 0; > int history_buf_len = 0; 140a143,151 > > if ( pset.cur_cmd_interactive ) > { > /* Pass all the contents of history_buf to > readline >* and free the history buffer. > >*/ >pgflush_history(&history_buf, > &history_buf_len); > } > 215c226,232 < --- > > if (pset.cur_cmd_interactive) > { > /* Put current line in the history buffer */ > history_buf = pgadd_history(line, history_buf, > &histo