On Sun, Nov 15, 2009 at 12:50:14AM +0000, Roger Leigh wrote: > On Sat, Nov 14, 2009 at 01:31:29PM -0500, Tom Lane wrote: > > Roger Leigh <rle...@codelibre.net> writes: > > > The side effect from this change is that some of the testsuite > > > expected data will need updating due to the extra pad spaces > > > > No, we are *not* doing that. Somebody made a change to the print.c > > logic last year that started adding "harmless" white space to the > > last column, and it was a complete disaster for tracking whether > > anything important had changed in regression test output. Please > > undo that part of your patch. > > No problem, done as requested. I've attached an updated patch that > takes care to exactly match the trailing whitespace the existing > psql outputs. This fixes most of the changes between observed and > expected test results.
Attached is an updated patch with a couple of tweaks to ensure output is formatted and spaced correctly when border=0, which was off in the last patch. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 7f03802..4b3fe71 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1765,18 +1765,40 @@ lo_import 152801 <listitem> <para> Sets the border line drawing style to one - of <literal>ascii</literal> or <literal>unicode</literal>. - Unique abbreviations are allowed. (That would mean one - letter is enough.) + of <literal>ascii</literal>, <literal>ascii-old</literal> + or <literal>unicode</literal>. Unique abbreviations are + allowed. (That would mean one letter is enough.) </para> <para> - <quote>ASCII</quote> uses plain <acronym>ASCII</acronym> characters. + <quote>ASCII</quote> uses plain <acronym>ASCII</acronym> + characters. Newlines in data are shown using + a <literal>+</literal> symbol in the right-hand margin, + while wrapped data uses a <literal>.</literal> symbol in the + right-hand margin of a wrapped line, and in the left-hand + margin of the following continuation line. </para> <para> + <quote>ASCII-old</quote> uses plain <acronym>ASCII</acronym> + characters, using the formatting style used + for <productname>PostgreSQL</productname> 8.4 and earlier. + Newlines in data are shown using a <literal>:</literal> + symbol in place of the left-hand column separator, while + wrapped data uses a <literal>;</literal> symbol. Newlines + in column headings are indicated by a <literal>+</literal> + symbol in the left-hand margin of additional lines. + </para> + + <para> <quote>Unicode</quote> uses Unicode box-drawing characters. - </para> + Newlines in data are shown using a carriage return symbol + (<literal>↵</literal>) in the right-hand margin. + Wrapped data uses an ellipsis symbol + (<literal>…</literal>) in the right-hand margin of a + wrapped line, and in the left-hand margin of the following + continuation line. + </para> <para> When the selected output format is one that draws lines or boxes diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 190a8d3..544a677 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1795,11 +1795,13 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) ; else if (pg_strncasecmp("ascii", value, vallen) == 0) popt->topt.line_style = &pg_asciiformat; + else if (pg_strncasecmp("ascii-old", value, vallen) == 0) + popt->topt.line_style = &pg_asciiformat_old; else if (pg_strncasecmp("unicode", value, vallen) == 0) popt->topt.line_style = &pg_utf8format; else { - psql_error("\\pset: allowed line styles are ascii, unicode\n"); + psql_error("\\pset: allowed line styles are ascii, ascii-old, unicode\n"); return false; } diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 026e043..5d1c8d4 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -45,9 +45,9 @@ static char *grouping; static char *thousands_sep; /* Line style control structures */ -const printTextFormat pg_asciiformat = +const printTextFormat pg_asciiformat_old = { - "ascii", + "ascii-old", { { "-", "+", "+", "+" }, { "-", "+", "+", "+" }, @@ -56,7 +56,36 @@ const printTextFormat pg_asciiformat = }, ":", ";", - " " + " ", + "+", + " ", + " ", + " ", + " ", + " ", + false +}; + +/* Line style control structures */ +const printTextFormat pg_asciiformat = +{ + "ascii", + { + { "-", "+", "+", "+" }, + { "-", "+", "+", "+" }, + { "-", "+", "+", "+" }, + { "", "|", "|", "|" } + }, + "|", + "|", + "|", + " ", + "+", + " ", + "+", + ".", + ".", + true }; const printTextFormat pg_utf8format = @@ -72,12 +101,23 @@ const printTextFormat pg_utf8format = /* N/A, │, │, │ */ { "", "\342\224\202", "\342\224\202", "\342\224\202" } }, - /* ╎ */ - "\342\225\216", - /* ┊ */ - "\342\224\212", - /* ╷ */ - "\342\225\267" + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + /* │ */ + "\342\224\202", + " ", + /* ↵ */ + "\342\206\265", + " ", + /* ↵ */ + "\342\206\265", + /* … */ + "\342\200\246", + /* … */ + "\342\200\246", + true }; @@ -479,6 +519,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout) int output_columns = 0; /* Width of interactive console */ bool is_pager = false; + printTextLineWrap *wrap; + if (cancel_pressed) return; @@ -499,6 +541,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) format_buf = pg_local_calloc(col_count, sizeof(*format_buf)); header_done = pg_local_calloc(col_count, sizeof(*header_done)); bytes_output = pg_local_calloc(col_count, sizeof(*bytes_output)); + wrap = pg_local_calloc(col_count, sizeof(*wrap)); } else { @@ -513,6 +556,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) format_buf = NULL; header_done = NULL; bytes_output = NULL; + wrap = NULL; } /* scan all column headers, find maximum width and max max_nl_lines */ @@ -575,7 +619,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) /* adjust the total display width based on border style */ if (opt_border == 0) - width_total = col_count - 1; + width_total = col_count; else if (opt_border == 1) width_total = col_count * 3 - 1; else @@ -770,16 +814,16 @@ print_aligned_text(const printTableContent *cont, FILE *fout) while (more_col_wrapping) { if (opt_border == 2) - fprintf(fout, "%s%c", dformat->leftvrule, - curr_nl_line ? '+' : ' '); - else if (opt_border == 1) - fputc(curr_nl_line ? '+' : ' ', fout); + fputs(dformat->leftvrule, fout); for (i = 0; i < cont->ncolumns; i++) { struct lineptr *this_line = col_lineptrs[i] + curr_nl_line; unsigned int nbspace; + if (opt_border != 0 || (format->cont_right_border == false && i > 0)) + fputs(curr_nl_line ? format->header_cont_left : " ", fout); + if (!header_done[i]) { nbspace = width_wrap[i] - this_line->width; @@ -796,21 +840,17 @@ print_aligned_text(const printTableContent *cont, FILE *fout) } else fprintf(fout, "%*s", width_wrap[i], ""); - if (i < col_count - 1) - { - if (opt_border == 0) - fputc(curr_nl_line ? '+' : ' ', fout); - else - fprintf(fout, " %s%c", dformat->midvrule, - curr_nl_line ? '+' : ' '); - } + + if (opt_border != 0 || format->cont_right_border == true) + fputs(!header_done[i] ? format->header_cont_right : " ", fout); + + if (opt_border != 0 && i < col_count - 1) + fputs(dformat->midvrule, fout); } curr_nl_line++; if (opt_border == 2) - fprintf(fout, " %s", dformat->rightvrule); - else if (opt_border == 1) - fputc(' ', fout); + fputs(dformat->rightvrule, fout); fputc('\n', fout); } @@ -861,19 +901,28 @@ print_aligned_text(const printTableContent *cont, FILE *fout) /* left border */ if (opt_border == 2) - fprintf(fout, "%s ", dformat->leftvrule); - else if (opt_border == 1) - fputc(' ', fout); + fputs(dformat->leftvrule, fout); /* for each column */ for (j = 0; j < col_count; j++) { /* We have a valid array element, so index it */ struct lineptr *this_line = &col_lineptrs[j][curr_nl_line[j]]; - int bytes_to_output; - int chars_to_output = width_wrap[j]; + int bytes_to_output; + int chars_to_output = width_wrap[j]; bool finalspaces = (opt_border == 2 || j < col_count - 1); + /* Print left-hand wrap or newline mark */ + if (opt_border != 0) + { + if (wrap[j] == PRINT_LINE_WRAP_WRAP) + fputs(format->wrap_left, fout); + else if (wrap[j] == PRINT_LINE_WRAP_CONT) + fputs(format->cont_left, fout); + else + fputc(' ', fout); + } + if (!this_line->ptr) { /* Past newline lines so just pad for other columns */ @@ -908,8 +957,6 @@ print_aligned_text(const printTableContent *cont, FILE *fout) /* spaces second */ fprintf(fout, "%.*s", bytes_to_output, this_line->ptr + bytes_output[j]); - if (finalspaces) - fprintf(fout, "%*s", width_wrap[j] - chars_to_output, ""); } bytes_output[j] += bytes_to_output; @@ -927,29 +974,51 @@ print_aligned_text(const printTableContent *cont, FILE *fout) } } - /* print a divider, if not the last column */ - if (j < col_count - 1) + /* Determine if next line for this column is wrapped or a newline */ + wrap[j] = PRINT_LINE_WRAP_NONE; + if (col_lineptrs[j][curr_nl_line[j]].ptr != NULL) { - if (opt_border == 0) - fputc(' ', fout); - /* Next value is beyond past newlines? */ + if (bytes_output[j] != 0) + wrap[j] = PRINT_LINE_WRAP_WRAP; + else if (curr_nl_line[j] != 0) + wrap[j] = PRINT_LINE_WRAP_CONT; + } + + /* If left-aligned, pad out remaining space if + * needed (not last column, and no wrap marks + * required). + */ + if (cont->aligns[j] != 'r') /* Left aligned cell */ + { + if (finalspaces || wrap[j] == PRINT_LINE_WRAP_WRAP || + wrap[j] == PRINT_LINE_WRAP_CONT) + fprintf(fout, "%*s", width_wrap[j] - chars_to_output, ""); + } + + /* Print right-hand wrap or newline mark */ + if (wrap[j] == PRINT_LINE_WRAP_WRAP) + fputs(format->wrap_right, fout); + else if (wrap[j] == PRINT_LINE_WRAP_CONT) + fputs(format->cont_right, fout); + else if (opt_border == 2 || j < col_count - 1) + fputc(' ', fout); + + if (opt_border != 0 && j < col_count - 1) + { + if (wrap[j+1] == PRINT_LINE_WRAP_WRAP) + fputs(format->midvrule_wrap, fout); + else if (wrap[j+1] == PRINT_LINE_WRAP_CONT) + fputs(format->midvrule_cont, fout); else if (col_lineptrs[j + 1][curr_nl_line[j + 1]].ptr == NULL) - fprintf(fout, " %s ", format->midvrule_blank); - /* In wrapping of value? */ - else if (bytes_output[j + 1] != 0) - fprintf(fout, " %s ", format->midvrule_wrap); - /* After first newline value */ - else if (curr_nl_line[j + 1] != 0) - fprintf(fout, " %s ", format->midvrule_cont); - /* Ordinary line */ + fputs(format->midvrule_blank, fout); else - fprintf(fout, " %s ", dformat->midvrule); + fputs(dformat->midvrule, fout); } } /* end-of-row border */ if (opt_border == 2) - fprintf(fout, " %s", dformat->rightvrule); + fputs(dformat->rightvrule, fout); fputc('\n', fout); } while (more_lines); @@ -1196,9 +1265,7 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout) fprintf(fout, "%*s", hwidth, ""); if (opt_border > 0) - fprintf(fout, " %s ", - (line_count == 0) ? - format->midvrule_cont : dformat->midvrule); + fprintf(fout, " %s ", dformat->midvrule); else fputc(' ', fout); diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index 056aaa6..4aafd61 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -41,14 +41,30 @@ typedef enum printTextRule PRINT_RULE_DATA /* data line (hrule is unused here) */ } printTextRule; +typedef enum printTextLineWrap +{ + /* Types of line continuation and wrapping */ + PRINT_LINE_WRAP_NONE = 0, /* No wrapping */ + PRINT_LINE_WRAP_WRAP = 1, /* Line is wrapped */ + PRINT_LINE_WRAP_CONT = 2, /* Continuation after newline */ + PRINT_LINE_WRAP_BLANK = 3 /* Blank line after end of data */ +} printTextLineWrap; + typedef struct printTextFormat { /* A complete line style */ - const char *name; /* for display purposes */ + const char *name; /* for display purposes */ printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ const char *midvrule_cont; /* vertical line for continue after newline */ const char *midvrule_wrap; /* vertical line for wrapped data */ const char *midvrule_blank; /* vertical line for blank data */ + const char *header_cont_left; /* continue after newline */ + const char *header_cont_right; /* continue after newline */ + const char *cont_left; /* continue after newline */ + const char *cont_right; /* continue after newline */ + const char *wrap_left; /* wrapped data */ + const char *wrap_right; /* wrapped data */ + bool cont_right_border; /* use right-hand border for continuation marks when border=0 */ } printTextFormat; typedef struct printTableOpt @@ -124,6 +140,7 @@ typedef struct printQueryOpt } printQueryOpt; +extern const printTextFormat pg_asciiformat_old; extern const printTextFormat pg_asciiformat; extern const printTextFormat pg_utf8format; diff --git a/src/test/regress/expected/dependency.out b/src/test/regress/expected/dependency.out index 6eb851a..d0895fb 100644 --- a/src/test/regress/expected/dependency.out +++ b/src/test/regress/expected/dependency.out @@ -71,9 +71,9 @@ RESET SESSION AUTHORIZATION; Access privileges Schema | Name | Type | Access privileges | Column access privileges --------+----------+-------+--------------------------------------------------+-------------------------- - public | deptest1 | table | regression_user0=arwdDxt/regression_user0 | - : regression_user1=a*r*w*d*D*x*t*/regression_user0 - : regression_user2=arwdDxt/regression_user1 + public | deptest1 | table | regression_user0=arwdDxt/regression_user0 +| + | | | regression_user1=a*r*w*d*D*x*t*/regression_user0+| + | | | regression_user2=arwdDxt/regression_user1 | (1 row) DROP OWNED BY regression_user1; diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out index f8dd6e8..bb3d167 100644 --- a/src/test/regress/expected/foreign_data.out +++ b/src/test/regress/expected/foreign_data.out @@ -366,14 +366,14 @@ GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role2 WITH GRANT OPTION; List of foreign servers Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options ------+-------------------+----------------------+-----------------------------------------+--------+---------+------------------------------ - s1 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user | | 1.0 | {servername=s1} - : regress_test_role=U/foreign_data_user + s1 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user +| | 1.0 | {servername=s1} + | | | regress_test_role=U/foreign_data_user | | | s2 | foreign_data_user | foo | | | 1.1 | {host=a,dbname=b} s3 | foreign_data_user | foo | | oracle | | {tnsname=orcl,port=1521} s4 | foreign_data_user | foo | | oracle | | {host=a,dbname=b} s5 | foreign_data_user | foo | | | 15.0 | - s6 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user | | 16.0 | {host=a,dbname=b} - : regress_test_role2=U*/foreign_data_user + s6 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user +| | 16.0 | {host=a,dbname=b} + | | | regress_test_role2=U*/foreign_data_user | | | s7 | foreign_data_user | foo | | oracle | 17.0 | {host=a,dbname=b} s8 | foreign_data_user | postgresql | | | | {host=localhost,dbname=s8db} t1 | regress_test_role | foo | | | | @@ -417,14 +417,14 @@ access to foreign-data wrapper foo List of foreign servers Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | Options ------+-----------------------+----------------------+-----------------------------------------+--------+---------+--------------------------------- - s1 | regress_test_indirect | foo | foreign_data_user=U/foreign_data_user | | 1.1 | {servername=s1} - : regress_test_role=U/foreign_data_user + s1 | regress_test_indirect | foo | foreign_data_user=U/foreign_data_user +| | 1.1 | {servername=s1} + | | | regress_test_role=U/foreign_data_user | | | s2 | foreign_data_user | foo | | | 1.1 | {host=a,dbname=b} s3 | foreign_data_user | foo | | oracle | | {tnsname=orcl,port=1521} s4 | foreign_data_user | foo | | oracle | | {host=a,dbname=b} s5 | foreign_data_user | foo | | | 15.0 | - s6 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user | | 16.0 | {host=a,dbname=b} - : regress_test_role2=U*/foreign_data_user + s6 | foreign_data_user | foo | foreign_data_user=U/foreign_data_user +| | 16.0 | {host=a,dbname=b} + | | | regress_test_role2=U*/foreign_data_user | | | s7 | foreign_data_user | foo | | oracle | 17.0 | {host=a,dbname=b} s8 | foreign_data_user | postgresql | | | | {dbname=db1,connect_timeout=30} t1 | regress_test_role | foo | | | | diff --git a/src/test/regress/expected/prepare.out b/src/test/regress/expected/prepare.out index 610f259..7016e82 100644 --- a/src/test/regress/expected/prepare.out +++ b/src/test/regress/expected/prepare.out @@ -154,20 +154,20 @@ SELECT name, statement, parameter_types FROM pg_prepared_statements ORDER BY name; name | statement | parameter_types ------+---------------------------------------------------------------------+-------------------------------------------------------- - q2 | PREPARE q2(text) AS | {text} - : SELECT datname, datistemplate, datallowconn - : FROM pg_database WHERE datname = $1; - q3 | PREPARE q3(text, int, float, boolean, oid, smallint) AS | {text,integer,"double precision",boolean,oid,smallint} - : SELECT * FROM tenk1 WHERE string4 = $1 AND (four = $2 OR - : ten = $3::bigint OR true = $4 OR oid = $5 OR odd = $6::int) - : ORDER BY unique1; - q5 | PREPARE q5(int, text) AS | {integer,text} - : SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2 - : ORDER BY unique1; - q6 | PREPARE q6 AS | {integer,name} - : SELECT * FROM tenk1 WHERE unique1 = $1 AND stringu1 = $2; - q7 | PREPARE q7(unknown) AS | {path} - : SELECT * FROM road WHERE thepath = $1; + q2 | PREPARE q2(text) AS +| {text} + | SELECT datname, datistemplate, datallowconn +| + | FROM pg_database WHERE datname = $1; | + q3 | PREPARE q3(text, int, float, boolean, oid, smallint) AS +| {text,integer,"double precision",boolean,oid,smallint} + | SELECT * FROM tenk1 WHERE string4 = $1 AND (four = $2 OR +| + | ten = $3::bigint OR true = $4 OR oid = $5 OR odd = $6::int)+| + | ORDER BY unique1; | + q5 | PREPARE q5(int, text) AS +| {integer,text} + | SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2 +| + | ORDER BY unique1; | + q6 | PREPARE q6 AS +| {integer,name} + | SELECT * FROM tenk1 WHERE unique1 = $1 AND stringu1 = $2; | + q7 | PREPARE q7(unknown) AS +| {path} + | SELECT * FROM road WHERE thepath = $1; | (5 rows) -- test DEALLOCATE ALL; diff --git a/src/test/regress/expected/triggers.out b/src/test/regress/expected/triggers.out index b21c93f..db96ccf 100644 --- a/src/test/regress/expected/triggers.out +++ b/src/test/regress/expected/triggers.out @@ -343,9 +343,9 @@ SELECT pg_get_triggerdef(oid) FROM pg_trigger WHERE tgrelid = 'main_table'::regc SELECT pg_get_triggerdef(oid, true) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'after_upd_a_b_row_trig'; pg_get_triggerdef --------------------------------------------------------- - CREATE TRIGGER after_upd_a_b_row_trig - AFTER UPDATE OF a, b ON main_table - FOR EACH ROW + CREATE TRIGGER after_upd_a_b_row_trig + + AFTER UPDATE OF a, b ON main_table + + FOR EACH ROW + EXECUTE PROCEDURE trigger_func('after_upd_a_b_row') (1 row) diff --git a/src/test/regress/expected/tsearch.out b/src/test/regress/expected/tsearch.out index 04b75dc..1cd9186 100644 --- a/src/test/regress/expected/tsearch.out +++ b/src/test/regress/expected/tsearch.out @@ -344,8 +344,8 @@ SELECT * FROM ts_parse('default', '345 q...@efd.r '' http://www.com/ http://aew.w 3 | ewri2 12 | 13 | <a href="qwe<qwe>"> - 12 | - : + 12 | + + | 19 | /usr/local/fff 12 | 19 | /awdf/dwqe/4325 @@ -377,8 +377,8 @@ SELECT * FROM ts_parse('default', '345 q...@efd.r '' http://www.com/ http://aew.w 20 | -4.2 12 | . 22 | 234 - 12 | - : + 12 | + + | 12 | < 1 | i 12 | @@ -559,9 +559,9 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'paint&water')); ts_headline ----------------------------------------- - <b>painted</b> Ocean. - <b>Water</b>, <b>water</b>, every where - And all the boards did shrink; + <b>painted</b> Ocean. + + <b>Water</b>, <b>water</b>, every where+ + And all the boards did shrink; + <b>Water</b>, <b>water</b>, every (1 row) @@ -578,9 +578,9 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'breath&motion&water')); ts_headline ---------------------------------- - <b>breath</b> nor <b>motion</b>, - As idle as a painted Ship - Upon a painted Ocean. + <b>breath</b> nor <b>motion</b>,+ + As idle as a painted Ship + + Upon a painted Ocean. + <b>Water</b>, <b>water</b> (1 row) @@ -597,9 +597,9 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'ocean')); ts_headline ---------------------------------- - <b>Ocean</b>. - Water, water, every where - And all the boards did shrink; + <b>Ocean</b>. + + Water, water, every where + + And all the boards did shrink;+ Water, water, every where (1 row) @@ -618,17 +618,17 @@ ff-bg to_tsquery('english', 'sea&foo'), 'HighlightAll=true'); ts_headline ----------------------------------------------------------------------------- - - <html> - <!-- some comment --> - <body> - <b>Sea</b> view wow <u><b>foo</b> bar</u> <i>qq</i> - <a href="http://www.google.com/foo.bar.html" target="_blank">YES </a> - ff-bg - <script> - document.write(15); - </script> - </body> + + + <html> + + <!-- some comment --> + + <body> + + <b>Sea</b> view wow <u><b>foo</b> bar</u> <i>qq</i> + + <a href="http://www.google.com/foo.bar.html" target="_blank">YES </a>+ + ff-bg + + <script> + + document.write(15); + + </script> + + </body> + </html> (1 row) @@ -646,13 +646,13 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'ocean'), 'MaxFragments=1'); ts_headline ------------------------------------ - after day, - We stuck, nor breath nor motion, - As idle as a painted Ship - Upon a painted <b>Ocean</b>. - Water, water, every where - And all the boards did shrink; - Water, water, every where, + after day, + + We stuck, nor breath nor motion,+ + As idle as a painted Ship + + Upon a painted <b>Ocean</b>. + + Water, water, every where + + And all the boards did shrink; + + Water, water, every where, + Nor any drop (1 row) @@ -670,13 +670,13 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2'); ts_headline ---------------------------------------------- - after day, day after day, - We <b>stuck</b>, nor breath nor motion, - As idle as a painted Ship - Upon a painted Ocean. - Water, water, every where - And all the boards did shrink; - Water, water, every where ... drop to drink. + after day, day after day, + + We <b>stuck</b>, nor breath nor motion, + + As idle as a painted Ship + + Upon a painted Ocean. + + Water, water, every where + + And all the boards did shrink; + + Water, water, every where ... drop to drink.+ S. T. <b>Coleridge</b> (1 row) @@ -694,9 +694,9 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'ocean & seahorse'), 'MaxFragments=1'); ts_headline ------------------------------------ - - Day after day, day after day, - We stuck, nor breath nor motion, + + + Day after day, day after day, + + We stuck, nor breath nor motion,+ As idle as (1 row) @@ -714,13 +714,13 @@ S. T. Coleridge (1772-1834) ', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2,FragmentDelimiter=***'); ts_headline -------------------------------------------- - after day, day after day, - We <b>stuck</b>, nor breath nor motion, - As idle as a painted Ship - Upon a painted Ocean. - Water, water, every where - And all the boards did shrink; - Water, water, every where***drop to drink. + after day, day after day, + + We <b>stuck</b>, nor breath nor motion, + + As idle as a painted Ship + + Upon a painted Ocean. + + Water, water, every where + + And all the boards did shrink; + + Water, water, every where***drop to drink.+ S. T. <b>Coleridge</b> (1 row) diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index a3e94e9..e46ed78 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -279,16 +279,16 @@ SELECT pg_get_viewdef('vsubdepartment'::regclass); SELECT pg_get_viewdef('vsubdepartment'::regclass, true); pg_get_viewdef -------------------------------------------------------------------------------------- - WITH RECURSIVE subdepartment AS ( - SELECT department.id, department.parent_department, department.name - FROM department - WHERE department.name = 'A'::text - UNION ALL - SELECT d.id, d.parent_department, d.name - FROM department d, subdepartment sd - WHERE d.parent_department = sd.id - ) - SELECT subdepartment.id, subdepartment.parent_department, subdepartment.name + WITH RECURSIVE subdepartment AS ( + + SELECT department.id, department.parent_department, department.name+ + FROM department + + WHERE department.name = 'A'::text + + UNION ALL + + SELECT d.id, d.parent_department, d.name + + FROM department d, subdepartment sd + + WHERE d.parent_department = sd.id + + ) + + SELECT subdepartment.id, subdepartment.parent_department, subdepartment.name + FROM subdepartment; (1 row)
signature.asc
Description: Digital signature