Re: [PATCHES] Patch to bring \copy syntax more in line with SQL
Bill Moran <[EMAIL PROTECTED]> writes: > Neil Conway wrote: >> - don't use C++-style comments > > Oops ... sorry ... been doing too much PHP. > > BTW: Why is this frowned apon so? Are there compilers that have > problems with it? IMHO it's not so much that it's considered THAT evil, it's just an easy thing for reviewers to spot :-) C++-style comments aren't C89 (although they are C99), so plenty of oldish compilers would be well within their rights to reject code that uses that style of commenting. Since the rest of the code is consistent in not using these comments, there's really no benefit to using them that I can see. > I'm not aware that the documentation needs updated. I changed the > code to be up to date with the docs I found. If there's docs that > need updated, please point me specifically to them and I'll be happy > to generate a patch to the best of my ability. doc/src/sgml/ref/psql-ref.sgml, circa line 705, obviously needs updating. That's the only place I could see, although I didn't spend much time looking. > Thanks for the quick feedback. I hope you didn't see that post to > hackers and take it as me bitching and whining or anything, it's just > that I'm not 100% familiar with how things flow within the PostgreSQL > group, and I was curious. No, it just reminded me about the patch. As for asking questions about procedure, that's fine with me (more often than not it's I who's asking :P) -Neil ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [PATCHES] Patch to bring \copy syntax more in line with SQL copy
Neil Conway wrote: A few quick comments: - don't use C++-style comments Oops ... sorry ... been doing too much PHP. BTW: Why is this frowned apon so? Are there compilers that have problems with it? In my own code, I generally use // and /* */ interchangeably, and I've never had any problems (with C). Yet, this isn't the first time I've submitted a patch and had it pointed out that I shouldn't use C++ comments in C. - please update the documentation I'm not aware that the documentation needs updated. I changed the code to be up to date with the docs I found. If there's docs that need updated, please point me specifically to them and I'll be happy to generate a patch to the best of my ability. - update the comment at the top of copy.c Oops ... got it. Bill Moran <[EMAIL PROTECTED]> writes: Ideally, this should cover all cases of old and new syntax, except where "AS" is present. ISTM it would be easy to allow for an optional 'AS' token following the 'DELIMITER[S]' token. Well ... keep in mind that I'm not as familiar with the code as you ... this is my first hack into PostgreSQL, and I'm not terribly familiar with the code yet. Now that I'm looking over the code for strtokx(), I'm seeing that you're absolutely right, it won't take much to accept the optional AS. The only drawback I can see is that \copy is now more liberal in what it accepts, and may accept incomplete statements without issuing an error (i.e. a WITH or USING clause at the end of a \copy statement will simply be ignored, and no error generated) Why can't you check for this? I suppose I can. It's just that the code falls together so simply without the check, and I can't see anyway to keep it that simple while still checking ... but I suppose it'd be better to have it fail properly than to save a few lines of code. Thanks for the quick feedback. I hope you didn't see that post to hackers and take it as me bitching and whining or anything, it's just that I'm not 100% familiar with how things flow within the PostgreSQL group, and I was curious. A revised patch will be forthcoming, as soon as I find some time ... a day or two probably, over the weekend as worst case scenerio. -- Bill Moran Potential Technologies http://www.potentialtech.com ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [PATCHES] psql prompts with invisible characters, take III
Tom- Here's take III of the patch, with the #ifdef for RL_PROMPT_START_IGNORE, the #else chopped, and made with diff -c against 7.4.1. A brief comment seemed warranted since this is an undocumented readline feature. Note that the #if is: #if defined (USE_READLINE) && defined (RL_PROMPT_START_IGNORE) Although this is pedantic (R_P_S_I implies U_R), it seemed more transparent for those who come this way hence. Do as you like with it. Fini? -Reece -- Reece Hart, http://www.in-machina.com/~reece/, GPG:0x25EC91A0 # patch for fancy (e.g., colored) prompts in psql, take III # # This is a patch to support readline prompts which contain non-printing # characters, as for fancy colorized prompts. This was nearly a direct # lift from bash-2.05b's lib/readline/display.c, per guidance from Chet Ramey. # # Usage: # Invisible characters within the prompt must be quoted with %[ and %]. # example: \set PROMPT1 '%[%033[1;[EMAIL PROTECTED]/%R%[%033[0m%]%# ' # diff -r --exclude='*.rej' --exclude='*.log' --exclude='*.so' --exclude='*.o' --exclude='*.orig' -c postgresql-7.4.1-orig/doc/src/sgml/ref/psql-ref.sgml postgresql-7.4.1/doc/src/sgml/ref/psql-ref.sgml *** postgresql-7.4.1-orig/doc/src/sgml/ref/psql-ref.sgml2003-10-31 17:56:29.0 -0800 --- postgresql-7.4.1/doc/src/sgml/ref/psql-ref.sgml 2004-01-16 09:56:54.0 -0800 *** *** 2236,2241 --- 2236,2265 + %[ ... %] + + +Prompts may contain terminal control characters which, for +example, change the color, background, or style of the prompt +text, or change the title of the terminal window. In order for +the line editing features of readline to work properly, these +non-printing control characters must be designated as invisible +by surrounding them with %[ and +%]. Multiple pairs of these may occur within +the prompt. For example, + + testdb=> \set PROMPT1 '%[%033[1;33;[EMAIL PROTECTED]/%R%[%033[0m%#%] ' + +results in a boldfaced (1;) yellow-on-black +33;40 prompt (within color-capable terminals). +See http://www.termsys.demon.co.uk/vtansi.htm";>http://www.termsys.demon.co.uk/vtansi.htm + for an example of allowable codes. + + + + + %R diff -r --exclude='*.rej' --exclude='*.log' --exclude='*.so' --exclude='*.o' --exclude='*.orig' -c postgresql-7.4.1-orig/src/bin/psql/prompt.c postgresql-7.4.1/src/bin/psql/prompt.c *** postgresql-7.4.1-orig/src/bin/psql/prompt.c 2003-10-03 18:04:46.0 -0700 --- postgresql-7.4.1/src/bin/psql/prompt.c 2004-01-20 09:33:23.0 -0800 *** *** 13,18 --- 13,19 #include "settings.h" #include "common.h" #include "variables.h" + #include "input.h" #ifdef WIN32 #include *** *** 241,246 --- 242,259 buf[0] = '>'; break; + case '[': + case ']': + #if defined (USE_READLINE) && defined (RL_PROMPT_START_IGNORE) + /* readline >=4.0 undocumented feature: non-printing +characters in prompt strings must be quoted in order +to properly display the line during editing. + */ + buf[0] = '\001'; + buf[1] = (*p == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE; + #endif /* USE_READLINE */ + break; + /* execute command */ case '`': { ---(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] Patch for search_path --- apply to 7.4 branch?
Hi Tom, I'd love to see it in a 7.4.2... With maybe the patch for SMP... Regards On Mon, 19 Jan 2004, Tom Lane wrote: > Date: Mon, 19 Jan 2004 14:15:08 -0500 > From: Tom Lane <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: [PATCHES] Patch for search_path --- apply to 7.4 branch? > > Attached is the patch I just applied to CVS HEAD to fix the search_path > problem that Olivier Prenant recently identified (can't set a search > path for another database if it mentions schemas not present in the > current database). I am looking for comments on whether to back-patch > this into REL7_4_STABLE. It is a rather large patch to fix what might > be considered a non-critical problem, so I'm a bit hesitant about back > patching. Any opinions? > > regards, tom lane > > -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) 6, Chemin d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: [EMAIL PROTECTED] -- Make your life a dream, make your dream a reality. (St Exupery) ---(end of broadcast)--- TIP 8: explain analyze is your friend