Why vertica is not supporting identity in temp table? Any alternate solution?

StackOverflow https://stackoverflow.com/questions/18908516

  •  29-06-2022
  •  | 
  •  

Domanda

When i am creating a temp table with identity in vertica , its showing error message as 'cant create a temp table with identity'. Why its not supporting? I need other solution please help me!!

È stato utile?

Soluzione

Instead of an identity, which is a special case of a sequence, you can explicitly create a sequence, and use it:

CREATE SEQUENCE tstident_seq;
CREATE TEMPORARY TABLE tstident (id INT DEFAULT NEXTVAL('tstident_seq'), value INT);
INSERT INTO tstident (value) VALUES (42);
-- to check
SELECT * FROM tstident;

The output is, as expected:

 id | value
----+-------
  1 |    42
(1 row)

Altri suggerimenti

create a regular table with a default projection with an identity, use it, and drop it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top