Hey there pmscorca
Thats a good question and thanks for using QandA platform
I guess yees, you can use the CREATE TABLE AS SELECT
(CTAS) statement to create a new table while maintaining the original primary key of the source table. but, you need to make sure that you define the primary key constraint in the new table. like this (see below code)
CREATE TABLE new_table
WITH
(
DISTRIBUTION = HASH(primary_key_column)
)
AS
SELECT *
FROM source_table
WHERE 1=0;
ALTER TABLE new_table ADD CONSTRAINT PK_new_table PRIMARY KEY (primary_key_column);
INSERT INTO new_table
SELECT *
FROM source_table;
If this helps kindly accept the answer thanks much.