"Create table if not exists" - how to check the schema, too?

Posted by Joonas Pulakka on Stack Overflow See other posts from Stack Overflow or by Joonas Pulakka
Published on 2010-03-19T12:15:22Z Indexed on 2010/03/19 12:41 UTC
Read the original article Hit count: 671

Filed under:
|
|
|

Is there a (more or less) standard way to check not only whether a table named mytable exists, but also whether its schema is similar to what it should be? I'm experimenting with H2 database, and

CREATE TABLE IF NOT EXISTS mytable (....)

statements apparently only check for the table´s name. I would expect to get an exception if there's a table with the given name, but different schema.

© Stack Overflow or respective owner

Related posts about database

Related posts about create-table