"Create table if not exists" - how to check the schema, too?
create-table, database, h2, sql
Solution
SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'TableName'
AND TABLE_SCHEMA = 'public'
Problem
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.