pg_get_indexdef() doesn't quote string reloptions - Mailing list pgsql-hackers

From Eric Ridge
Subject pg_get_indexdef() doesn't quote string reloptions
Date
Msg-id 5D265224-30B2-4A1E-811E-E4F60E21FA45@tcdi.com
Whole thread Raw
Responses Re: pg_get_indexdef() doesn't quote string reloptions
Re: pg_get_indexdef() doesn't quote string reloptions
List pgsql-hackers
Hi all!

I've been working on implementing a custom index using the Index Access Method API and have the need for custom
reloptionsthat are "complex" strings (ie, also contain non-alphaumerics). 

pg_get_indexdef() and pg_dump don't quote the reloption values, making a restore (or cut-n-paste of the
pg_get_indexdef()output) impossible if the reloption value contains non-alphanumerics. 

For example, the statement:
# CREATE INDEX idxfoo ON table USING myindex (col) WITH (option = 'some complex string');

cannot be restored as it gets rewritten as:
CREATE INDEX idxfoo ON table USING myindex (col) WITH (option = some complex string);    (note the lack of quotes
aroundthe option value) 

Looks like (at least) ruleutils.c:flatten_reloptions() needs to be smarter.

eric




PROPRIETARY AND COMPANY CONFIDENTIAL COMMUNICATIONS
The information contained in this communication is intended only for
the use of the addressee. Any other use is strictly prohibited.
Please notify the sender if you have received this message in error.
This communication is protected by applicable legal privileges and is
company confidential.




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] PostgreSQL 9.4 mmap(2) performance regression on FreeBSD...
Next
From: Andrew Dunstan
Date:
Subject: Re: jsonb generator functions