0

I have a query that looks like this in postgres:

ALTER TABLE alias_table ALTER COLUMN iddb SET DEFAULT nextval('alias_table_iddb_seq');

I would like to translate it into hsql. I know that I can do it by enabling PostgreSQL syntax Compatibility:

SET DATABASE SQL SYNTAX PGS TRUE;
ALTER TABLE alias_table ALTER COLUMN iddb SET DEFAULT nextval('alias_table_iddb_seq');

However I'm interested in pure hsql syntax. I know I could do it on create table syntax using something like:

CREATE TABLE alias_table ( 
  iddb bigint GENERATED BY DEFAULT AS SEQUENCE alias_table_iddb_seq PRIMARY KEY
);

But, how can I do it from alter table syntax?

gawi
  • 2,843
  • 4
  • 29
  • 44

1 Answers1

0

Currently the only supported ALTER TABLE syntax is in the PGS compatibility mode.

In the next version (2.5.1) syntax similar to that used for CREATE TABLE will be supported.

ALTER TABLE alias_table ALTER COLUMN iddb GENERATED BY DEFAULT AS SEQUENCE alias_table_iddb_seq
fredt
  • 24,044
  • 3
  • 40
  • 61