1

I have two user-defined types:

CREATE TYPE s.s_stavp_kv AS ENUM('k','v');

and

CREATE TYPE s.stavp_kv AS ENUM('k','v');

Table looks like this

CREATE TABLE s.zv_stavp
(
   version integer NOT NULL,
   id integer NOT NULL,
   tudu integer NOT NULL,
   kv s_stavp_kv NOT NULL,
   cobj text NOT NULL,
   iobj text NOT NULL,
   typev text
)

Now i need to change type of kv to stavp_kv type. Im trying something like:

ALTER TABLE s.zv_stavp 
  ALTER COLUMN kv TYPE stavp_kv USING ...???...;

But I dont know at all what to write as USING expression.

1 Answer 1

1

The answer is:

ALTER TABLE s.zv_stavp 
  ALTER COLUMN kv TYPE stavp_kv USING kv::text::stavp_kv;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.