Nope. I can break that trivially, eg:
Thats why in my first message I mentioned escaping and unescaping all '%' in the deinition.
There's also the nontrivial matter of how pg_dump would decide where to insert the %%tablespace%% string into the CREATE INDEX command in the first place.
I'd vote against parsing, and add a parameter to get_indexdef.
If we're going to add code to parse CREATE INDEX and insert the tablespace in the correct place, meseems it'd be better to insert it on the pg_restore side.
But if we have to parse, I'd add it in pg_dump so all items that are relevant can be dumped with '%%tablespace%%'. pg_dump still constructs CREATE TABLE statements, so that is the natural place to add the tablespace marker and avoid parsing for tables.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp.mit.edu:11371 |/
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org