RvSingh3213
RvSingh3213

Reputation: 189

Syntax error at or near "TYPE" in Postgresql

Hi I was trying to create Type but getting a Syntax error while doing it.

CREATE OR REPLACE TYPE ARR_HNW_ID AS VARRAY(50) OF INTEGER;


Can you please help me to resolve this Issue

enter image description here

Upvotes: 1

Views: 1309

Answers (2)

Julius Tuskenis
Julius Tuskenis

Reputation: 1620

Thera are multiple mistakes in your SQL:

  1. There is no CREATE OR REPLACE TYPE syntax in PostgreSQL- take a look into docs;
  2. There is no type VARRAY in postgresql. If you need an array of integer just declare it like integer[].
  3. What you are creating here is not a type but a DOMAIN.

So basically you can simply use integer[] for your ARR_HNW_ID

Upvotes: 1

NickW
NickW

Reputation: 9778

I don’t believe OR REPLACE is valid syntax. You can CREATE or ALTER types but not REPLACE

Upvotes: 1

Related Questions