Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Jim Nasby
Adding -general back in... As someone else already mentioned, you can't have multiple primary keys on one table. > From: Daniel Kunkel [mailto:[EMAIL PROTECTED] > ERROR: ALTER TABLE / PRIMARY KEY multiple primary keys for table > 'product_price' are not allowed > > > On Thu, 2006-01-05 at 22:

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Stephan Szabo
On Fri, 6 Jan 2006, Daniel Kunkel wrote: > Thank you for taking time to give that a try. > > I'm currently running 7.3.10. In that case, if you do a drop constraint and then try manually dropping the index (probably drop index product_price_pkey), does it work? ---(end of

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Jaime Casanova
On 1/6/06, Daniel Kunkel <[EMAIL PROTECTED]> wrote: > Hi > > It makes sense that I can't have more than 1 primary key. > > Postgres was trying to create another primary key instead of modify the > existing primary key. > > So... > > As I understand it, a table does not always have to have a primary

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Daniel Kunkel
Hi Thank you for taking time to give that a try. I'm currently running 7.3.10. On Fri, 2006-01-06 at 07:50 -0800, Stephan Szabo wrote: > On Thu, 5 Jan 2006, Daniel Kunkel wrote: > > > It makes sense that I can't have more than 1 primary key. > > > > Postgres was trying to create another prima

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Stephan Szabo
On Thu, 5 Jan 2006, Daniel Kunkel wrote: > It makes sense that I can't have more than 1 primary key. > > Postgres was trying to create another primary key instead of modify the > existing primary key. > > So... > > As I understand it, a table does not always have to have a primary key > defined. >

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Daniel Kunkel
Hi Yes... It's the only solution I know will work, but this is a core table on a live system, and I haven't done this before. Does anyone have a proven script they could share? On Fri, 2006-01-06 at 08:22 -0700, Guy Fraser wrote: > Have you considered dumping the data, dropping the table and

Re: [GENERAL] Adding another primary key to a populated table

2006-01-06 Thread Guy Fraser
Have you considered dumping the data, dropping the table and building the replacement table with the correct properties then repopulating the table with the dumped data? On Thu, 2006-05-01 at 23:02 -0800, Daniel Kunkel wrote: > Why do I want to include 6 fields in the primary key? > > Good que

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Daniel Kunkel
Why do I want to include 6 fields in the primary key? Good question... I don't know. It's a requirement of OFBiz, a really awesome ERP/CRM/Accounting/ECommerce system. I'm upgrading the software which requires it, and need to upgrade the database to match. Once I find out, I'll publish the so

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Aaron Koning
Are you trying to create a primary key composed of 6 fields? What is the result you want to achieve with the constraint? If you just want UNIQUE, NOT NULL values in a field, you can achieve that without creating a primary key. AaronOn 1/5/06, Daniel Kunkel <[EMAIL PROTECTED]> wrote: HiIt makes sen

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Daniel Kunkel
Hi It makes sense that I can't have more than 1 primary key. Postgres was trying to create another primary key instead of modify the existing primary key. So... As I understand it, a table does not always have to have a primary key defined. Would it work to first delete/drop the primary key, t

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Andrew - Supernews
On 2006-01-06, Daniel Kunkel <[EMAIL PROTECTED]> wrote: > Hi > > I'm trying to add another primary key to a table populated with data and > a number of foreign key constraints. You can only have one primary key on a table. You can add additional unique constraints to get the same effect. (A prima

Re: [GENERAL] Adding another primary key to a populated table

2006-01-05 Thread Jim C. Nasby
On Thu, Jan 05, 2006 at 08:08:39PM -0800, Daniel Kunkel wrote: > Hi > > I'm trying to add another primary key to a table populated with data and > a number of foreign key constraints. > > The new column is populated with non-null data (a requirement as I > understand it to become a valid primary