On 17 September 2014 19:55, Szymon Guz <mabew...@gmail.com> wrote: > > > On 17 September 2014 19:30, Peter Eisentraut <pete...@gmx.net> wrote: > >> On 9/16/14 3:52 PM, Szymon Guz wrote: >> > It's not finished yet, I'm not sure it there is any sense in supporting >> > border types etc. >> >> AFAICT, Asciidoc doesn't support border types, so (if so) you should >> just ignore that setting. >> > > Too late, I've done something like this: > > border=0 > [frame="none",grid="none"] > > border=1 > [frame="all",grid="none"] > > border=2 > [frame="all",grid="all"] > > thanks, > Szymon >
Hi, thanks for all the remarks. I've attached another version of this patch. I think it's done. - This works: `\pset format asciidoc` - Output is formatted as asciidoc tables. - There is support for borders {0,1,2}. The attached html file was made by running tests for psql, taking the asciidoc tables from it, converting to html with `asciidoc file`. -- border = 0 -> [frame="none",grid="none"] -- border = 1 -> [frame="none",grid="all"] -- border = 2 -> [frame="all",grid="all"] - There are also tests. -- For normal and extended mode combined with each of the border values. -- With column names made of characters which need escaping -- With values: (with escape needed characters, string '11' and integer 11 - they should have different right-left alignment). - Documentation for psql is updated. - According to Emanuel's advice: help.c is updated. The attached html file contains tables from the test in this order: normal, border 0 normal, border 1 normal, border 2 expanded, border 0 expanded, border 1 expanded, border 2 regards, Szymon
<<< text/html; charset=US-ASCII; name="asciidoc_output.html": Unrecognized >>>
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index e7fcc73..cd64b88 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -2092,8 +2092,8 @@ lo_import 152801 <literal>aligned</literal>, <literal>wrapped</literal>, <literal>html</literal>, <literal>latex</literal> (uses <literal>tabular</literal>), - <literal>latex-longtable</literal>, or - <literal>troff-ms</literal>. + <literal>latex-longtable</literal>, + <literal>troff-ms</literal>, or <literal>asciidoc</literal>. Unique abbreviations are allowed. (That would mean one letter is enough.) </para> @@ -2120,7 +2120,8 @@ lo_import 152801 <para> The <literal>html</>, <literal>latex</>, - <literal>latex-longtable</literal>, and <literal>troff-ms</> + <literal>latex-longtable</literal>, <literal>troff-ms</>, + and <literal>asciidoc</> formats put out tables that are intended to be included in documents using the respective mark-up language. They are not complete documents! This might not be diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 2227db4..ae6b106 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2247,6 +2247,9 @@ _align2string(enum printFormat in) case PRINT_TROFF_MS: return "troff-ms"; break; + case PRINT_ASCIIDOC: + return "asciidoc"; + break; } return "unknown"; } @@ -2316,9 +2319,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) popt->topt.format = PRINT_LATEX_LONGTABLE; else if (pg_strncasecmp("troff-ms", value, vallen) == 0) popt->topt.format = PRINT_TROFF_MS; + else if (pg_strncasecmp("asciidoc", value, vallen) == 0) + popt->topt.format = PRINT_ASCIIDOC; else { - psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, latex, troff-ms\n"); + psql_error("\\pset: allowed formats are unaligned, aligned, wrapped, html, latex, troff-ms, asciidoc\n"); return false; } diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 6035a77..66da6ec 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -351,7 +351,7 @@ helpVariables(unsigned short int pager) fprintf(output, _(" expanded (or x) toggle expanded output\n")); fprintf(output, _(" fieldsep field separator for unaligned output (default '|')\n")); fprintf(output, _(" fieldsep_zero set field separator in unaligned mode to zero\n")); - fprintf(output, _(" format set output format [unaligned, aligned, wrapped, html, latex, ..]\n")); + fprintf(output, _(" format set output format [unaligned, aligned, wrapped, html, latex, asciidoc ..]\n")); fprintf(output, _(" footer enable or disable display of the table footer [on, off]\n")); fprintf(output, _(" linestyle set the border line drawing style [ascii, old-ascii, unicode]\n")); fprintf(output, _(" null set the string to be printed in place of a null value\n")); diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 3b3c3b7..956bbb1 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -2475,6 +2475,200 @@ print_troff_ms_vertical(const printTableContent *cont, FILE *fout) } } +/*********************/ +/* ASCIIDOC **********/ +/*********************/ + +static void +print_asciidoc_text(const printTableContent *cont, FILE *fout) +{ + bool opt_tuples_only = cont->opt->tuples_only; + unsigned short opt_border = cont->opt->border; + unsigned int i; + const char *const * ptr; + + if (cancel_pressed) + return; + + if (cont->opt->start_table) + { + /* print title */ + if (!opt_tuples_only && cont->title) + { + fputs(".", fout); + fputs(cont->title, fout); + fputs("\n", fout); + } + + /* print table [] header definition */ + fputs("[options=\"header\",cols=\"", fout); + for(i = 0; i < cont->ncolumns; i++) { + if (i != 0) fputs(",", fout); + fprintf(fout, "%s", cont->aligns[(i) % cont->ncolumns] == 'r' ? ">literal" : "<literal"); + } + fputs("\"", fout); + switch (opt_border) { + case 0: + fputs(",frame=\"none\",grid=\"none\"", fout); + break; + case 1: + fputs(",frame=\"none\"", fout); + break; + case 2: + fputs(",frame=\"all\",grid=\"all\"", fout); + break; + } + fputs("]\n", fout); + fputs("|====\n", fout); + + /* print headers */ + if (!opt_tuples_only) + { + for (ptr = cont->headers; *ptr; ptr++) + { + fputs("^| +++", fout); + fputs(*ptr, fout); + fputs("+++ ", fout); + } + fputs("\n", fout); + } + } + + /* print cells */ + for (i = 0, ptr = cont->cells; *ptr; i++, ptr++) + { + if (i % cont->ncolumns == 0) + { + if (cancel_pressed) + break; + } + + fprintf(fout, "| "); + + if ((*ptr)[strspn(*ptr, " \t")] == '\0') + fputs(" ", fout); + else + fputs(*ptr, fout); + + fputs(" ", fout); + + if ((i + 1) % cont->ncolumns == 0) + fputs("\n", fout); + + } + + fputs("|====\n", fout); + + if (cont->opt->stop_table) + { + printTableFooter *footers = footers_with_default(cont); + + /* print footers */ + if (!opt_tuples_only && footers != NULL && !cancel_pressed) + { + printTableFooter *f; + + fputs("\n....\n", fout); + for (f = footers; f; f = f->next) + { + fputs(f->data, fout); + fputs("\n", fout); + } + fputs("....\n", fout); + } + + } +} + +static void +print_asciidoc_vertical(const printTableContent *cont, FILE *fout) +{ + bool opt_tuples_only = cont->opt->tuples_only; + unsigned short opt_border = cont->opt->border; + unsigned long record = cont->opt->prior_records + 1; + unsigned int i; + const char *const * ptr; + + if (cancel_pressed) + return; + + if (cont->opt->start_table) + { + /* print title */ + if (!opt_tuples_only && cont->title) + { + fputs(".", fout); + fputs(cont->title, fout); + fputs("\n", fout); + } + + /* print table [] header definition */ + fputs("[cols=\"h,literal\"", fout); + switch (opt_border) { + case 0: + fputs(",frame=\"none\",grid=\"none\"", fout); + break; + case 1: + fputs(",frame=\"none\"", fout); + break; + case 2: + fputs(",frame=\"all\",grid=\"all\"", fout); + break; + } + fputs("]\n", fout); + fputs("|====\n", fout); + + } + + /* print records */ + for (i = 0, ptr = cont->cells; *ptr; i++, ptr++) + { + if (i % cont->ncolumns == 0) + { + if (cancel_pressed) + break; + if (!opt_tuples_only) + fprintf(fout, + "2+^| Record %lu\n", + record++); + else + fputs("2| \n", fout); + } + + fputs("|+++", fout); + fputs(cont->headers[i % cont->ncolumns], fout); + fputs("+++", fout); + + fprintf(fout, " %s|", cont->aligns[i % cont->ncolumns] == 'r' ? ">" : "<"); + /* is string only whitespace? */ + if ((*ptr)[strspn(*ptr, " \t")] == '\0') + fputs(" ", fout); + else + fputs(*ptr, fout); + + fputs("\n", fout); + } + + fputs("|====\n", fout); + + if (cont->opt->stop_table) + { + /* print footers */ + if (!opt_tuples_only && cont->footers != NULL && !cancel_pressed) + { + printTableFooter *f; + + fputs("\n....\n", fout); + for (f = cont->footers; f; f = f->next) + { + fputs(f->data, fout); + fputs("\n", fout); + } + fputs("....\n", fout); + } + + } +} /********************************/ /* Public functions */ @@ -2872,6 +3066,12 @@ printTable(const printTableContent *cont, FILE *fout, FILE *flog) else print_troff_ms_text(cont, fout); break; + case PRINT_ASCIIDOC: + if (cont->opt->expanded == 1) + print_asciidoc_vertical(cont, fout); + else + print_asciidoc_text(cont, fout); + break; default: fprintf(stderr, _("invalid output format (internal error): %d"), cont->opt->format); diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index f668b23..cf885ad 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -20,7 +20,8 @@ enum printFormat PRINT_HTML, PRINT_LATEX, PRINT_LATEX_LONGTABLE, - PRINT_TROFF_MS + PRINT_TROFF_MS, + PRINT_ASCIIDOC /* add your favourite output format here ... */ }; diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index b80fe13..a0c5230 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3633,7 +3633,7 @@ psql_completion(const char *text, int start, int end) { static const char *const my_list[] = {"unaligned", "aligned", "wrapped", "html", "latex", - "troff-ms", NULL}; + "troff-ms", "asciidoc", NULL}; COMPLETE_WITH_LIST_CS(my_list); } diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index 3764127..4544c69 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -2123,3 +2123,203 @@ execute q; +------------------+-------------------+ deallocate q; +prepare q as select 'lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&' as "012345678 9abc def!*@#&!@(*&*~~_+-=\ \", '11' as "0123456789", 11 as int from generate_series(1,10) as n; +\pset format asciidoc +\pset expanded off +\pset border 0 +execute q; +[options="header",cols="<literal,<literal,>literal",frame="none",grid="none"] +|==== +^| +++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ ^| +++0123456789+++ ^| +++int+++ +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +|==== + +.... +(10 rows) +.... +\pset border 1 +execute q; +[options="header",cols="<literal,<literal,>literal",frame="none"] +|==== +^| +++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ ^| +++0123456789+++ ^| +++int+++ +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +|==== + +.... +(10 rows) +.... +\pset border 2 +execute q; +[options="header",cols="<literal,<literal,>literal",frame="all",grid="all"] +|==== +^| +++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ ^| +++0123456789+++ ^| +++int+++ +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +| lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& | 11 | 11 +|==== + +.... +(10 rows) +.... +\pset expanded on +\pset border 0 +execute q; +[cols="h,literal",frame="none",grid="none"] +|==== +2+^| Record 1 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 2 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 3 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 4 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 5 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 6 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 7 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 8 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 9 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 10 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +|==== +\pset border 1 +execute q; +[cols="h,literal",frame="none"] +|==== +2+^| Record 1 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 2 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 3 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 4 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 5 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 6 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 7 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 8 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 9 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 10 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +|==== +\pset border 2 +execute q; +[cols="h,literal",frame="all",grid="all"] +|==== +2+^| Record 1 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 2 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 3 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 4 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 5 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 6 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 7 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 8 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 9 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +2+^| Record 10 +|+++012345678 9abc def!*@#&!@(*&*~~_+-=\ \+++ <|lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (& +|+++0123456789+++ <|11 +|+++int+++ >|11 +|==== +deallocate q; diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql index 5ccc68f..6537c53 100644 --- a/src/test/regress/sql/psql.sql +++ b/src/test/regress/sql/psql.sql @@ -276,3 +276,28 @@ execute q; execute q; deallocate q; + +prepare q as select 'lkjsafi\\/ /oeu rio)(!@&*#)*(!&@*) \ (&' as "012345678 9abc def!*@#&!@(*&*~~_+-=\ \", '11' as "0123456789", 11 as int from generate_series(1,10) as n; + +\pset format asciidoc +\pset expanded off +\pset border 0 +execute q; + +\pset border 1 +execute q; + +\pset border 2 +execute q; + +\pset expanded on +\pset border 0 +execute q; + +\pset border 1 +execute q; + +\pset border 2 +execute q; + +deallocate q;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers