Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: syntax error at or near "modify" - in postgres

I executed this SQL statement in Postgres

alter table user modify column 'distinguishedName1' text;

and

alter table user modify column distinguishedName1 text;
  • user is the table name
  • distinguishedName1 is the column name with integer data type.

I wanted to modify the data type to boolean or text or varchar(256) etc based on user's input. But when I run the query I get the error

ERROR: syntax error at or near "modify"

Not sure what is the problem. Help required on right query.

like image 829
Manushi Avatar asked Mar 25 '26 21:03

Manushi


1 Answers

POSTGRES syntax for altering column type :

ALTER TABLE user ALTER COLUMN distinguishedName1 TYPE text;
like image 148
sagi Avatar answered Mar 28 '26 15:03

sagi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!