Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-26 Thread Gurjeet Singh
On Wed, Jan 26, 2011 at 6:14 AM, Tom Lane t...@sss.pgh.pa.us wrote: Gurjeet Singh singh.gurj...@gmail.com writes: Attached is the updated patch with doc changes and test cases. Applied with assorted corrections. Aside from the refactoring I wanted, there were various oversights. Looking

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-25 Thread Joshua Tolley
On Mon, Jan 24, 2011 at 07:01:13PM -0500, Tom Lane wrote: One other issue that might be worthy of discussion is that as things stand, execution of the ADD CONSTRAINT USING INDEX syntax will cause the constraint to absorb the index as an INTERNAL dependency. That means dropping the constraint

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-25 Thread Gurjeet Singh
Sorry for not being on top of this. On Tue, Jan 25, 2011 at 9:01 AM, Tom Lane t...@sss.pgh.pa.us wrote: I wrote: ... If that's the only issue then I don't see any need to wait on the author, so will take this one. I find myself quite dissatisfied with the way that this patch adds yet

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-25 Thread Tom Lane
Gurjeet Singh singh.gurj...@gmail.com writes: On Tue, Jan 25, 2011 at 9:01 AM, Tom Lane t...@sss.pgh.pa.us wrote: One other issue that might be worthy of discussion is that as things stand, execution of the ADD CONSTRAINT USING INDEX syntax will cause the constraint to absorb the index as an

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-25 Thread Gurjeet Singh
On Wed, Jan 26, 2011 at 5:31 AM, Tom Lane t...@sss.pgh.pa.us wrote: In the end I think this is mainly an issue of setting appropriate expectations in the documentation. I've added the following text to the ALTER TABLE manual page: para After this command is executed, the index is

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-25 Thread Tom Lane
Gurjeet Singh singh.gurj...@gmail.com writes: Attached is the updated patch with doc changes and test cases. Applied with assorted corrections. Aside from the refactoring I wanted, there were various oversights. I have consciously disallowed the ability to specify storage_parameters using

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-24 Thread Tom Lane
Steve Singer ssinger...@sympatico.ca writes: src/backend/parser/parse_utilcmd.c: 1452 Your calling strdup on the attribute name. I don't have a good enough grasp on the code to be able to trace this through to where the memory gets free'd. Does it get freed? Should/could this be a call to

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-24 Thread Tom Lane
I wrote: ... If that's the only issue then I don't see any need to wait on the author, so will take this one. I find myself quite dissatisfied with the way that this patch adds yet another bool flag to index_create (which has too many of those already), with the effect of causing it to exactly

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-24 Thread Robert Haas
On Mon, Jan 24, 2011 at 7:01 PM, Tom Lane t...@sss.pgh.pa.us wrote: One other issue that might be worthy of discussion is that as things stand, execution of the ADD CONSTRAINT USING INDEX syntax will cause the constraint to absorb the index as an INTERNAL dependency.  That means dropping the

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-16 Thread Steve Singer
I've taken a look at this version of the patch. Submission Review This version of the patch applies cleanly to master. It matches your git repo and includes test + docs. Usability Review --- The command syntax now matches what was discussed during the last cf.

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-16 Thread Robert Haas
On Sun, Jan 16, 2011 at 5:34 PM, Steve Singer ssinger...@sympatico.ca wrote: I'm marking this as returned with feedback pending your answer on the possible memory leak above but I think the patch is very close to being ready. Please use Waiting on Author if the patch is to be considered

Re: [HACKERS] Patch to add a primary key using an existing index

2011-01-06 Thread Gurjeet Singh
On Thu, Dec 9, 2010 at 2:48 PM, Tom Lane t...@sss.pgh.pa.us wrote: Gurjeet Singh singh.gurj...@gmail.com writes: But I still hold a bias towards renaming the index to match constraint name (with a NOTICE), rather than require that the constraint name match the index name, because the

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-09 Thread Gurjeet Singh
On Sun, Dec 5, 2010 at 2:09 PM, Peter Eisentraut pete...@gmx.net wrote: On fre, 2010-12-03 at 15:27 -0500, Robert Haas wrote: On Fri, Dec 3, 2010 at 2:56 PM, r t pg...@xzilla.net wrote: What exactly was the objection to the following -- ALTER TABLE table_name ADD PRIMARY KEY

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-09 Thread Tom Lane
Gurjeet Singh singh.gurj...@gmail.com writes: But I still hold a bias towards renaming the index to match constraint name (with a NOTICE), rather than require that the constraint name match the index name, because the constraint name is optional and when it is not provided system has to

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-09 Thread Kevin Grittner
Tom Lane t...@sss.pgh.pa.us wrote: If the constraint name is not specified, we should certainly use the existing index name, not randomly rename it. +1 -Kevin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-09 Thread Robert Haas
On Thu, Dec 9, 2010 at 2:51 PM, Kevin Grittner kevin.gritt...@wicourts.gov wrote: Tom Lane t...@sss.pgh.pa.us wrote: If the constraint name is not specified, we should certainly use the existing index name, not randomly rename it. +1 +1 -- Robert Haas EnterpriseDB:

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-05 Thread Peter Eisentraut
On fre, 2010-12-03 at 15:27 -0500, Robert Haas wrote: On Fri, Dec 3, 2010 at 2:56 PM, r t pg...@xzilla.net wrote: What exactly was the objection to the following -- ALTER TABLE table_name ADD PRIMARY KEY (column_list) USING index_name; Is the objection that you might have been trying to

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-04 Thread Robert Haas
On Dec 4, 2010, at 1:30 AM, Tom Lane t...@sss.pgh.pa.us wrote: Ross J. Reedstrom reeds...@rice.edu writes: If you consider that an index basically is, in some sense, a pre-canned column list, then: ALTER TABLE table_name ADD PRIMARY KEY (column_list); ALTER TABLE table_name ADD PRIMARY KEY

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-04 Thread Robert Treat
On Sat, Dec 4, 2010 at 6:48 AM, Robert Haas robertmh...@gmail.com wrote: On Dec 4, 2010, at 1:30 AM, Tom Lane t...@sss.pgh.pa.us wrote: Ross J. Reedstrom reeds...@rice.edu writes: If you consider that an index basically is, in some sense, a pre-canned column list, then: ALTER TABLE

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-04 Thread Tom Lane
Robert Treat r...@xzilla.net writes: Actually I think I'd even be comfortable with A, either you must name the constraint after the index, or you can leave the constraint name out, and we'll use the index name. Or we could omit the CONSTRAINT name clause from the syntax altogether. I think

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-04 Thread Robert Haas
On Dec 4, 2010, at 11:46 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Treat r...@xzilla.net writes: Actually I think I'd even be comfortable with A, either you must name the constraint after the index, or you can leave the constraint name out, and we'll use the index name. Or we could omit

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-04 Thread Josh Berkus
On 12/04/2010 12:37 PM, Robert Haas wrote: What would make sense to me is: create a pk constraint with the sane name as the existing unique index. If that constraint name already exists, error. +1, agreed. Based on this, the syntax should be obvious. We'll need to doc what to do in the

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Peter Eisentraut
On sön, 2010-11-28 at 20:40 -0500, Robert Haas wrote: On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On Fri, Nov 26, 2010 at 05:58, Steve Singer ssin...@ca.afilias.info wrote: The attached version of the patch gets your regression tests to pass. I'm

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Robert Haas
On Fri, Dec 3, 2010 at 2:23 PM, Peter Eisentraut pete...@gmx.net wrote: On sön, 2010-11-28 at 20:40 -0500, Robert Haas wrote: On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On Fri, Nov 26, 2010 at 05:58, Steve Singer ssin...@ca.afilias.info wrote: The

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Heikki Linnakangas
On 03.12.2010 21:43, Robert Haas wrote: On Fri, Dec 3, 2010 at 2:23 PM, Peter Eisentrautpete...@gmx.net wrote: On sön, 2010-11-28 at 20:40 -0500, Robert Haas wrote: On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On Fri, Nov 26, 2010 at 05:58, Steve

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Alvaro Herrera
Excerpts from Heikki Linnakangas's message of vie dic 03 16:45:59 -0300 2010: ALTER TABLE table_name SET PRIMARY KEY USING INDEX index_name. Quite verbose, but imho USING makes it much more clear that it's an existing index. I was going to post the same thing (well except I was still

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread r t
On Fri, Dec 3, 2010 at 2:43 PM, Robert Haas robertmh...@gmail.com wrote: On Fri, Dec 3, 2010 at 2:23 PM, Peter Eisentraut pete...@gmx.net wrote: On sön, 2010-11-28 at 20:40 -0500, Robert Haas wrote: On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Heikki Linnakangas
On 03.12.2010 21:58, Alvaro Herrera wrote: Excerpts from Heikki Linnakangas's message of vie dic 03 16:45:59 -0300 2010: ALTER TABLE table_name SET PRIMARY KEY USING INDEX index_name. Quite verbose, but imho USING makes it much more clear that it's an existing index. I was going to post the

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Robert Haas
On Fri, Dec 3, 2010 at 2:56 PM, r t pg...@xzilla.net wrote: What exactly was the objection to the following -- ALTER TABLE table_name ADD PRIMARY KEY (column_list) USING index_name; Is the objection that you might have been trying to specify a constraint named using ? I'm willing to make that

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Josh Berkus
On 12/3/10 12:27 PM, Robert Haas wrote: On Fri, Dec 3, 2010 at 2:56 PM, r t pg...@xzilla.net wrote: What exactly was the objection to the following -- ALTER TABLE table_name ADD PRIMARY KEY (column_list) USING index_name; Is the objection that you might have been trying to specify a constraint

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Robert Treat
On Fri, Dec 3, 2010 at 4:41 PM, Josh Berkus j...@agliodbs.com wrote: On 12/3/10 12:27 PM, Robert Haas wrote: On Fri, Dec 3, 2010 at 2:56 PM, r t pg...@xzilla.net wrote: What exactly was the objection to the following -- ALTER TABLE table_name ADD PRIMARY KEY (column_list) USING index_name;

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Ross J. Reedstrom
On Fri, Dec 03, 2010 at 05:16:04PM -0500, Robert Treat wrote: On Fri, Dec 3, 2010 at 4:41 PM, Josh Berkus j...@agliodbs.com wrote: However, I don't see why we need (column_list). Surely the index has a column list already? ALTER TABLE table_name ADD CONSTRAINT pk_name PRIMARY KEY USING

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Josh Berkus
On 12/3/10 2:16 PM, Robert Treat wrote: Uh, the syntax I posted was based on this currently valid syntax: ALTER TABLE table_name ADD PRIMARY KEY (column_list); The constraint bit is optional, which is why I left it out, but I presume it would be optional with the new syntax as well...

Re: [HACKERS] Patch to add a primary key using an existing index

2010-12-03 Thread Tom Lane
Ross J. Reedstrom reeds...@rice.edu writes: If you consider that an index basically is, in some sense, a pre-canned column list, then: ALTER TABLE table_name ADD PRIMARY KEY (column_list); ALTER TABLE table_name ADD PRIMARY KEY USING index_name; are parallel constructions. And it avoids the

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-28 Thread Itagaki Takahiro
On Fri, Nov 26, 2010 at 05:58, Steve Singer ssin...@ca.afilias.info wrote: The attached version of the patch gets your regression tests to pass. I'm going to mark this as ready for a committer. I think we need more discussions about the syntax: ALTER TABLE table_name ADD PRIMARY KEY (...)

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-28 Thread Robert Haas
On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On Fri, Nov 26, 2010 at 05:58, Steve Singer ssin...@ca.afilias.info wrote: The attached version of the patch gets your regression tests to pass. I'm going to mark this as ready for a committer. I think we need

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-28 Thread David Fetter
On Sun, Nov 28, 2010 at 08:40:08PM -0500, Robert Haas wrote: On Sun, Nov 28, 2010 at 8:06 PM, Itagaki Takahiro itagaki.takah...@gmail.com wrote: On Fri, Nov 26, 2010 at 05:58, Steve Singer ssin...@ca.afilias.info wrote: The attached version of the patch gets your regression tests to pass.

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-25 Thread Steve Singer
On 10-11-22 03:24 PM, Steve Singer wrote: On 10-11-22 09:37 AM, Gurjeet Singh wrote: On Sat, Nov 20, 2010 at 9:00 AM, Steve Singer ssinger...@sympatico.ca Almost fixed. I still get an unexpected difference. ! DETAIL: cannot create PRIMARY KEY/UNIQUE constraint with a non-unique index.

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-22 Thread Gurjeet Singh
On Sat, Nov 20, 2010 at 9:00 AM, Steve Singer ssinger...@sympatico.cawrote: Submission Review: Tests The expected output for the regression tests you added don't match what I'm getting when I run the tests with your patch applied. I think you just need

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-22 Thread Steve Singer
On 10-11-22 09:37 AM, Gurjeet Singh wrote: On Sat, Nov 20, 2010 at 9:00 AM, Steve Singer ssinger...@sympatico.ca mailto:ssinger...@sympatico.ca wrote: Submission Review: Tests The expected output for the regression tests you added don't

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-19 Thread Steve Singer
On 10-11-07 01:54 PM, Gurjeet Singh wrote: Attached is the patch that extends the same feature for UNIQUE indexes. It also includes some doc changes for the ALTER TABLE command, but I could not verify the resulting changes since I don't have the doc-building infrastructure installed. Regards,

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-07 Thread Gurjeet Singh
Depesz brought that to my attention a few days after the initial submission, and adding support for UNIQUE was not much pain. I implemented it almost immediately, but didn't announce it as I was hoping I could submit some doc changes too with that. If you are the adventurous kind, you can follow

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-07 Thread Gurjeet Singh
Attached is the patch that extends the same feature for UNIQUE indexes. It also includes some doc changes for the ALTER TABLE command, but I could not verify the resulting changes since I don't have the doc-building infrastructure installed. Regards, On Mon, Nov 8, 2010 at 1:39 AM, Gurjeet

Re: [HACKERS] Patch to add a primary key using an existing index

2010-11-01 Thread Jim Nasby
UNIQUE constraints suffer from the same behavior; feel like fixing that too? :) On Oct 9, 2010, at 1:07 PM, Gurjeet Singh wrote: This is a continuation from this thread: http://archives.postgresql.org/pgsql-hackers/2010-09/msg02153.php The attached patch allows creating a primary key using

Re: [HACKERS] Patch to add a primary key using an existing index

2010-10-09 Thread Gurjeet Singh
On Sat, Oct 9, 2010 at 2:07 PM, Gurjeet Singh singh.gurj...@gmail.comwrote: This is a continuation from this thread: http://archives.postgresql.org/pgsql-hackers/2010-09/msg02153.php The attached patch allows creating a primary key using an existing index. I have attached two versions of

Re: [HACKERS] Patch to add a primary key using an existing index

2010-10-09 Thread Andrew Dunstan
On 10/09/2010 02:19 PM, Gurjeet Singh wrote: On Sat, Oct 9, 2010 at 2:07 PM, Gurjeet Singh singh.gurj...@gmail.com mailto:singh.gurj...@gmail.com wrote: This is a continuation from this thread: http://archives.postgresql.org/pgsql-hackers/2010-09/msg02153.php The attached patch

archives, attachments, etc (was: [HACKERS] Patch to add a primary key using an existing index)

2010-10-09 Thread Dimitri Fontaine
Andrew Dunstan and...@dunslane.net writes: I wish we could get the archive processor to provide access to the attachments even if they have a MIME type of text/whatever. That's a horrid inefficiency. Maybe we could restrict it to text attachments that have a Content-Type with a name attribute

Re: archives, attachments, etc (was: [HACKERS] Patch to add a primary key using an existing index)

2010-10-09 Thread Gurjeet Singh
On Sat, Oct 9, 2010 at 3:30 PM, Dimitri Fontaine dimi...@2ndquadrant.frwrote: Andrew Dunstan and...@dunslane.net writes: I wish we could get the archive processor to provide access to the attachments even if they have a MIME type of text/whatever. That's a horrid inefficiency. Maybe we