Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aEfGt-00076v-HV for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Dec 2015 15:36:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aEfGs-0002Rf-JW for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Dec 2015 15:36:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aEfGq-0002RI-Rr for pgsql-bugs@postgresql.org; Thu, 31 Dec 2015 15:36:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aEfGm-0002PK-8G for pgsql-bugs@postgresql.org; Thu, 31 Dec 2015 15:36:07 +0000 MIME-Version: 1.0 Subject: BUG #13840: pg_dump generates unloadable SQL when third party string type index option is used To: pgsql-bugs@postgresql.org From: kou@clear-code.com Date: Thu, 31 Dec 2015 15:35:22 +0000 Message-ID: <20151231153522.1117.56276@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13840 Logged by: Kouhei Sutou Email address: kou@clear-code.com PostgreSQL version: 9.4.5 Operating system: Debian GNU/Linux sid Description: PostgreSQL supports amindex extension. But pg_dump doesn't support string type custom index options for amindex extension. Amindex extension can support custom index options that can be used by "CREATE INDEX ... WITH (option_name = option_value)" syntax. Amindex extension uses add_string_reloption() to add a string type option. PostgreSQL requires quotation for option_value such as: CREATE INDEX pgroonga_index ON t USING pgroonga (c) WITH (normalizer = 'none'); PGroonga(*) is used in the above example. PGroonga is an amindex extension that adds "normalizer" option. (*) http://pgroonga.github.io/ If we specify option value without quotation, PostgreSQL reports an error: CREATE TABLE t (c text); CREATE INDEX pgroonga_index ON t USING pgroonga (c) WITH (normalizer = none); -- ERROR: syntax error at or near "none" -- LINE 1: ...onga_index ON t USING pgroonga (c) WITH (normalizer = none); -- ^ pg_dump generates "CREATE INDEX ... WITH ..." without quotation for option value: % pg_dump -d option_test ... CREATE TABLE t ( c text ); ... CREATE INDEX pgroonga_index ON t USING pgroonga (c) WITH (normalizer=none); ... "normalizer=none" causes error on restoring the dump. pg_dump should generates "normalizer='none'" as option to avoid the error. FYI1: This problem isn't occurred for built-in options such as "buffering" option for gist. Because values for "buffering" option are registered as keywords. PostgreSQL can parse keyword-ed values without quotation such as "buffering = on". It's implemented in src/backend/parser/gram.y: def_arg: func_type { $$ = (Node *)$1; } | reserved_keyword { $$ = (Node *)makeString(pstrdup($1)); } | qual_all_Op { $$ = (Node *)$1; } | NumericOnly { $$ = (Node *)$1; } | Sconst { $$ = (Node *)makeString($1); } "reserved_keyword" doesn't require quotation. It means that using PGroonga is easy-to-reproduce this problem. Here is an install document of PGroonga: http://pgroonga.github.io/install/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs