Thank you!

From: James Taylor [mailto:jamestay...@apache.org]
Sent: Tuesday, July 14, 2015 1:34 PM
To: user
Subject: Re: How to adjust primary key on existing table

Yes. UPSERT SELECT. Have you seen this yet? 
https://phoenix.apache.org/language/index.html

On Tue, Jul 14, 2015 at 10:21 AM, Riesland, Zack 
<zack.riesl...@sensus.com<mailto:zack.riesl...@sensus.com>> wrote:
Thanks James,

That’s what I thought.

If I were to make a NEW table with the same columns, is there a simple way to 
copy the data from the old table to the new one?

From: James Taylor 
[mailto:jamestay...@apache.org<mailto:jamestay...@apache.org>]
Sent: Tuesday, July 14, 2015 1:17 PM
To: user
Subject: Re: How to adjust primary key on existing table

Ah, we don't support that currently. You can drop the existing column first 
(but you lose your data, though you could set a CURRENT_SCN property on your 
connection to prevent this data loss). Then you could run the command I 
mentioned.

On Tue, Jul 14, 2015 at 10:14 AM, Riesland, Zack 
<zack.riesl...@sensus.com<mailto:zack.riesl...@sensus.com>> wrote:
Thanks James,

To clarify: the column already exists on the table, but I want to add it to the 
primary key.

Is that what your example accomplishes?

From: James Taylor 
[mailto:jamestay...@apache.org<mailto:jamestay...@apache.org>]
Sent: Tuesday, July 14, 2015 1:11 PM
To: user
Subject: Re: How to adjust primary key on existing table

ALTER TABLE t ADD my_new_col VARCHAR PRIMARY KEY

The new column must be nullable and the last existing PK column cannot be 
nullable and fixed width (or varbinary or array).

On Tue, Jul 14, 2015 at 10:01 AM, Riesland, Zack 
<zack.riesl...@sensus.com<mailto:zack.riesl...@sensus.com>> wrote:
This is probably a lame question, but can anyone point me in the right 
direction for CHANGING and EXISTING primary key on a table?

I want to add a column.

Is it possible to do that without dropping the table?

Thanks!





Reply via email to