Adjust behavior of single-user -j mode for better initdb error reporting.
Previously, -j caused the entire input file to be read in and executed as
a single command string. That's undesirable, not least because any error
causes the entire file to be regurgitated as the "failing query". Some
experimentation suggests a better rule: end the command string when we see
a semicolon immediately followed by two newlines, ie, an empty line after
a query. This serves nicely to break up the existing examples such as
information_schema.sql and system_views.sql. A limitation is that it's
no longer possible to write such a sequence within a string literal or
multiline comment in a file meant to be read with -j; but there are no
instances of such a problem within the data currently used by initdb.
(If someone does make such a mistake in future, it'll be obvious because
they'll get an unterminated-literal or unterminated-comment syntax error.)
Other than that, there shouldn't be any negative consequences; you're not
forced to end statements that way, it's just a better idea in most cases.
In passing, remove src/include/tcop/tcopdebug.h, which is dead code
because it's not included anywhere, and hasn't been for more than
ten years. One of the debug-support symbols it purported to describe
has been unreferenced for at least the same amount of time, and the
other is removed by this commit on the grounds that it was useless:
forcing -j mode all the time would have broken initdb. The lack of
complaints about that, or about the missing inclusion, shows that
no one has tried to use TCOP_DONTUSENEWLINE in many years.
2015-12-18 01:34:15 +01:00
|
|
|
/*
|
|
|
|
* text search configuration for _LANGNAME_ language
|
|
|
|
*
|
2022-01-08 01:04:57 +01:00
|
|
|
* Copyright (c) 2007-2022, PostgreSQL Global Development Group
|
Adjust behavior of single-user -j mode for better initdb error reporting.
Previously, -j caused the entire input file to be read in and executed as
a single command string. That's undesirable, not least because any error
causes the entire file to be regurgitated as the "failing query". Some
experimentation suggests a better rule: end the command string when we see
a semicolon immediately followed by two newlines, ie, an empty line after
a query. This serves nicely to break up the existing examples such as
information_schema.sql and system_views.sql. A limitation is that it's
no longer possible to write such a sequence within a string literal or
multiline comment in a file meant to be read with -j; but there are no
instances of such a problem within the data currently used by initdb.
(If someone does make such a mistake in future, it'll be obvious because
they'll get an unterminated-literal or unterminated-comment syntax error.)
Other than that, there shouldn't be any negative consequences; you're not
forced to end statements that way, it's just a better idea in most cases.
In passing, remove src/include/tcop/tcopdebug.h, which is dead code
because it's not included anywhere, and hasn't been for more than
ten years. One of the debug-support symbols it purported to describe
has been unreferenced for at least the same amount of time, and the
other is removed by this commit on the grounds that it was useless:
forcing -j mode all the time would have broken initdb. The lack of
complaints about that, or about the missing inclusion, shows that
no one has tried to use TCOP_DONTUSENEWLINE in many years.
2015-12-18 01:34:15 +01:00
|
|
|
*
|
|
|
|
* src/backend/snowball/snowball.sql.in
|
|
|
|
*
|
|
|
|
* _LANGNAME_ and certain other macros are replaced for each language;
|
|
|
|
* see the Makefile for details.
|
|
|
|
*
|
|
|
|
* Note: this file is read in single-user -j mode, which means that the
|
|
|
|
* command terminator is semicolon-newline-newline; whenever the backend
|
|
|
|
* sees that, it stops and executes what it's got. If you write a lot of
|
|
|
|
* statements without empty lines between, they'll all get quoted to you
|
|
|
|
* in any error message about one of them, so don't do that. Also, you
|
|
|
|
* cannot write a semicolon immediately followed by an empty line in a
|
|
|
|
* string literal (including a function body!) or a multiline comment.
|
|
|
|
*/
|
2007-08-21 03:11:32 +02:00
|
|
|
|
|
|
|
CREATE TEXT SEARCH DICTIONARY _DICTNAME_
|
2007-08-25 03:06:25 +02:00
|
|
|
(TEMPLATE = snowball, Language = _LANGNAME_ _STOPWORDS_);
|
2007-08-21 03:11:32 +02:00
|
|
|
|
2007-09-03 04:30:45 +02:00
|
|
|
COMMENT ON TEXT SEARCH DICTIONARY _DICTNAME_ IS 'snowball stemmer for _LANGNAME_ language';
|
2007-08-21 03:11:32 +02:00
|
|
|
|
|
|
|
CREATE TEXT SEARCH CONFIGURATION _CFGNAME_
|
|
|
|
(PARSER = default);
|
|
|
|
|
2007-09-03 04:30:45 +02:00
|
|
|
COMMENT ON TEXT SEARCH CONFIGURATION _CFGNAME_ IS 'configuration for _LANGNAME_ language';
|
2007-08-21 03:11:32 +02:00
|
|
|
|
|
|
|
ALTER TEXT SEARCH CONFIGURATION _CFGNAME_ ADD MAPPING
|
2007-10-27 18:01:09 +02:00
|
|
|
FOR email, url, url_path, host, file, version,
|
|
|
|
sfloat, float, int, uint,
|
|
|
|
numword, hword_numpart, numhword
|
2007-08-21 03:11:32 +02:00
|
|
|
WITH simple;
|
|
|
|
|
|
|
|
ALTER TEXT SEARCH CONFIGURATION _CFGNAME_ ADD MAPPING
|
2007-10-23 22:46:12 +02:00
|
|
|
FOR asciiword, hword_asciipart, asciihword
|
|
|
|
WITH _ASCDICTNAME_;
|
2007-08-21 03:11:32 +02:00
|
|
|
|
|
|
|
ALTER TEXT SEARCH CONFIGURATION _CFGNAME_ ADD MAPPING
|
2007-10-23 22:46:12 +02:00
|
|
|
FOR word, hword_part, hword
|
|
|
|
WITH _NONASCDICTNAME_;
|