Thread: [PATCH] Fix CREATE INDEX/CONSTRAINT syntax when tablespace and fillfactor are specified

Hi list,

Quite recently I stumbled upon this bug in pgAdminIII and today I was
reading Guillaume Lelarge's article about pgAdmin's git repository and
this is the result. :)

The patch is attached, or you can also get it at
http://github.com/intgr/pgadmin3 branch "mybugfix"

Regards,
Marti

----
Commit message:
Fix CREATE INDEX/CONSTRAINT syntax when tablespace and fillfactor are specified

Reverse the order of TABLESPACE and WITH() clauses for indexes.  Previously
pgAdminIII generated CREATE scripts like:

ALTER TABLE foo ADD CONSTRAINT foo_pkey PRIMARY KEY(foo_id)
  USING INDEX TABLESPACE bar WITH (FILLFACTOR=50);
CREATE INDEX foo_foo_id ON foo USING btree (foo_id)
  TABLESPACE bar WITH (FILLFACTOR=50);

However these are illegal PostgreSQL syntax, the WITH() clause must come before
TABLESPACE.

The statements generated by "new index" or "new primary key" dialogs are
already correct.

Attachment
Hi Marti,

Le 05/10/2010 23:33, Marti Raudsepp a écrit :
> [...]
> Quite recently I stumbled upon this bug in pgAdminIII and today I was
> reading Guillaume Lelarge's article about pgAdmin's git repository and
> this is the result. :)
>

That's just great. I didn't expect that someone would use this blog post
so quickly. And you don't appear to be alone:
http://github.com/postgres/pgadmin3/network

> The patch is attached, or you can also get it at
> http://github.com/intgr/pgadmin3 branch "mybugfix"
>

OK, nice work. I'll check this tomorrow. Thanks for your work.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com

Le 06/10/2010 00:25, Guillaume Lelarge a écrit :
> Hi Marti,
>
> Le 05/10/2010 23:33, Marti Raudsepp a écrit :
>> [...]
>> Quite recently I stumbled upon this bug in pgAdminIII and today I was
>> reading Guillaume Lelarge's article about pgAdmin's git repository and
>> this is the result. :)
>>
>
> That's just great. I didn't expect that someone would use this blog post
> so quickly. And you don't appear to be alone:
> http://github.com/postgres/pgadmin3/network
>
>> The patch is attached, or you can also get it at
>> http://github.com/intgr/pgadmin3 branch "mybugfix"
>>
>
> OK, nice work. I'll check this tomorrow. Thanks for your work.
>

Done, and commited. I also commited a substract of your patch on the
1.12 branch (we didn't have the tablespace issue in the index constraint
back in 1.12).

Thanks again.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com