Home > Enterprise >  Syntax error at or near "TYPE" in Postgresql
Syntax error at or near "TYPE" in Postgresql

Time:09-30

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

CodePudding user response:

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

CodePudding user response:

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

  • Related