Menu

#320 Add support for CREATE [ object type ] IF NOT EXISTS

open-fixed
None
5
2022-07-28
2016-01-23
Lukas Eder
No

Other databases (e.g. PostgreSQL, H2) support an optional "IF NOT EXISTS" clause on some (all?) CREATE [ object type ] DDL statements. This would be a useful and probably simple feature addition.

HSQLDB already supports IF EXISTS on some DROP statements, so this would be the inverse feature.

Discussion

  • Fred Toussi

    Fred Toussi - 2016-01-23

    HSQLDB supports IF NOT EXISTS for CREATE TABLE and CREATE SEQUENCE. Support might be added for more object types.

    CREATE TABLE IF NOT EXISTS <table name> ...

     

    Last edit: Fred Toussi 2016-01-23
  • Lukas Eder

    Lukas Eder - 2016-01-23

    Thanks for the feedback.

    Indeed, I've tried it later on with CREATE TABLE and it does work (although, it is missing from the docs: http://www.hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_table_creation)

    I was particularly looking for CREATE VIEW IF NOT EXISTS and CREATE INDEX IF NOT EXISTS

     
  • Fred Toussi

    Fred Toussi - 2016-01-23

    OK Lukas, I will add them.

     
  • Lukas Eder

    Lukas Eder - 2016-01-24

    Thank you very much! :)

     
  • Fred Toussi

    Fred Toussi - 2016-01-25

    Support for CREATE VIEW, CREATE INDEX added. Also ALTER TABLE <name> ADD CONSTRAINT [IF NOT EXISTS] <constraint name=""> is supported. Committed to SVN for 2.3.4

     
  • Fred Toussi

    Fred Toussi - 2022-07-28
    • status: open --> open-fixed
    • assigned_to: Fred Toussi
     

Log in to post a comment.