Database Administrators
Q&A for database professionals who wish to improve their database skills
Latest Questions
0
votes
1
answers
184
views
H2 Database - Alter multiple databases
I need to alter a table in H2 db. But we have millions of databases with the same same table. What may be the feasible way to alter such databases?
I need to alter a table in H2 db. But we have millions of databases with the same same table. What may be the feasible way to alter such databases?
user3111540
(1 rep)
Feb 9, 2018, 06:27 AM
• Last activity: Jun 20, 2025, 07:08 AM
1
votes
0
answers
1132
views
converting/adapting time postgres SQL to H2
I have a quite large SQL that runs towards postgres in production today, and due to some performance reasons, I am converting our integration tests to unit tests. The integration tests ran towards a docker postgres image, but it is simply way to slow to setup, so I am experimenting with an H2 in-mem...
I have a quite large SQL that runs towards postgres in production today, and due to some performance reasons, I am converting our integration tests to unit tests.
The integration tests ran towards a docker postgres image, but it is simply way to slow to setup, so I am experimenting with an H2 in-mem database. It is as expected really quick to setup and works in most cases... However I have this statement
(timezone('America/New_York', timestamp) - ('1 hour')::interval)::date
That simply does not work in H2.
One reason is that the function timezone
does not exist, but that seems like an easy fix by just creating an alias to a java timezone function.
What is slightly trickier is this part ('1 hour')::interval
as it results in this exception
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "SELECT (('1 HOUR')::INTERVAL)[*]::DATE FROM t"; expected "YEAR, MONTH, DAY, HOUR, MINUTE, SECOND"; SQL statement:
And I am kind of at an loss as to if it is possible to adapt h2 to accept it. And I am saying adapt h2, because there might be other issues related to changing the SQL (that needs to run towards postgres in prod).
So is it possible to adapt h2 to accept this?
and if not, is there some other way to write the sql to have it working for both postgres and h2?
and as a sidenote: does this question belong here, or at stackoverflow?
munHunger
(121 rep)
Feb 22, 2021, 08:02 AM
6
votes
1
answers
11753
views
Keep H2 in-memory database between connections
I create and use a H2 database in-memory (no writing to storage) for demos and quick tests using this code in Java: Connection conn = DriverManager.getConnection( "jdbc:h2:mem:example_db" ) ; This works the first time, but then the database seems to disappear, unavailable for further work. How can I...
I create and use a H2 database in-memory (no writing to storage) for demos and quick tests using this code in Java:
Connection conn = DriverManager.getConnection( "jdbc:h2:mem:example_db" ) ;
This works the first time, but then the database seems to disappear, unavailable for further work. How can I make use of the same in-memory database over time?
Basil Bourque
(11188 rep)
Dec 6, 2018, 08:58 PM
• Last activity: Oct 20, 2019, 11:00 PM
0
votes
1
answers
217
views
Recursive CTE throws temp tablespace is empty error
I need to aggregate the contents of multiple rows into a row as a delimited text. Here's the simplified table with sample data which represents what i want to do. CREATE TABLE SPD_OWNER.EMP ( EMPID NUMBER, NAME VARCHAR2(20), MGRID NUMBER, DEPT VARCHAR2(5) ); INSERT INTO EMP (EMPID, NAME, MGRID, DEPT...
I need to aggregate the contents of multiple rows into a row as a delimited text. Here's the simplified table with sample data which represents what i want to do.
CREATE TABLE SPD_OWNER.EMP (
EMPID NUMBER,
NAME VARCHAR2(20),
MGRID NUMBER,
DEPT VARCHAR2(5)
);
INSERT INTO EMP (EMPID, NAME, MGRID, DEPT) VALUES(1, 'GPM', NULL, 'IT');
INSERT INTO EMP (EMPID, NAME, MGRID, DEPT) VALUES(2, 'SPM', 1, 'IT');
INSERT INTO EMP (EMPID, NAME, MGRID, DEPT) VALUES(3, 'PM', 2, 'IT');
INSERT INTO EMP (EMPID, NAME, MGRID, DEPT) VALUES(4, 'Dev1', 3, 'IT');
INSERT INTO EMP (EMPID, NAME, MGRID, DEPT) VALUES(5, 'Dev2', 4, 'IT');
-- query which has issue
WITH tmp (rnum,dept,id) AS
(SELECT rownum rnum, dept, to_char(empid) AS id FROM (SELECT dept, empid FROM emp WHERE dept='IT' ORDER BY empid)),
cte (rnum,dept,id) AS
(SELECT rnum, dept, id FROM tmp WHERE rnum=1
UNION ALL
SELECT cte.rnum+1, tmp.dept, cte.id||'/'||tmp.id FROM cte JOIN tmp on tmp.rnum=cte.rnum+1)
SELECT * FROM cte cte1
WHERE rnum=(SELECT max(rnum) FROM cte cte2 WHERE cte1.dept=cte2.dept);
Am expecting below output.
5 IT 1/2/3/4/5
But running above query gives me an error SQL Error : ORA-25153: Temporary Tablespace is Empty
Isn't the condition tmp.rnum=cte.rnum+1 sufficient to break the recursive loop? Here's what am imagining to be happening.
1. 1st select (above union all) will select rnum=1
2. 1st recursive iteration will select tmp.rnum=cte.rnum+1, i.e.
tmp.rnum=2
3. 2nd recursive iteration will select tmp.rnum=3
4. and so on till this condition is invalid, i.e. when cte.rnum=5 (because then tmp.rum=5+1 will not have matching record)
Am assuming that am getting the error since it's going into infinite loop.
What am i missing?
Side Note: Am using Oracle DB, so i can easily do this using LISTAGG. But i also want to run this query in H2 DB. So i want to have a solution that uses standard sql. Am open to other ways to achieve the same result.
Cyriac George
(3 rep)
Mar 26, 2019, 07:44 AM
• Last activity: Mar 26, 2019, 08:49 AM
4
votes
1
answers
21901
views
H2 ALTER TABLE ADD COLUMN BEFORE/AFTER
According to H2 syntax documentation [available here][1] I should be able to execute a query like: ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124) AFTER FIRST_NAME; However apparently only this query works: ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124); Is it a mistake in the d...
According to H2 syntax documentation available here I should be able to execute a query like:
ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124) AFTER FIRST_NAME;
However apparently only this query works:
ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124);
Is it a mistake in the documentation or am I missing something?
The BEFORE and AFTER parameters would be useful to me.
dendini
(395 rep)
Jun 12, 2013, 10:01 AM
• Last activity: Feb 7, 2019, 12:15 PM
3
votes
0
answers
83
views
On the INSERT statement in H2, what does `DIRECT` mean?
I noticed on the grammar documentation for [`INSERT`][1] in the [H2 Database Engine][2], the optional word `DIRECT`. The documentation says: >When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step. When is data inserted *not* “direct...
I noticed on the grammar documentation for
INSERT
in the H2 Database Engine , the optional word DIRECT
. The documentation says:
>When using DIRECT, then the results from the query are directly applied in the target table without any intermediate step.
When is data inserted *not* “directly applied”? What are these “intermediated steps”?
➥ What is the purpose of DIRECT
?
➥ In what scenarios might one be motivated to use this feature?
Basil Bourque
(11188 rep)
Dec 23, 2018, 08:57 PM
1
votes
1
answers
71
views
Are many two column indexes a bad smell?
I have table that contains failures. (15000 rows + on a abstract embedded system) A failure has the following fields: - id *PK BIGINT* - errorNumber *INT* - source *VARCHAR* - raisedAt *BIGINT* - clearedAt *BIGINT* - cleared (computed column for sorting purposes = clearedat>0) *BOOL* My first use ca...
I have table that contains failures. (15000 rows + on a abstract embedded system)
A failure has the following fields:
- id *PK BIGINT*
- errorNumber *INT*
- source *VARCHAR*
- raisedAt *BIGINT*
- clearedAt *BIGINT*
- cleared (computed column for sorting purposes = clearedat>0) *BOOL*
My first use case Is that I want to display all failures, the uncleared ones first.
Select * from FAILURES ORDER BY CLEARED asc, raisedAt desc;
Second use case is by a synchronization job. I want to delete all synchronized and **cleared** failures, there for all failures with an id smaller X and cleared
DELETE FROM FAILURES WHERE ID AND CLEARED;
Third use case is that I want to pick a specific uncleared failure.
SELECT * FROM FAILURES WHERE SOURCE=? AND ERRORNUMBER=? AND NOT CLEARED;
This would lead me to the following indexes:
CREATE INDEX CLEARED_RAISEDAT_SORTED_FAILURES ON FAILURE_MANAGER.FAILURES (cleared asc,raisedat desc);
CREATE INDEX CLEARED_ID_FAILURES ON FAILURE_MANAGER.FAILURES (cleared asc,id desc);
CREATE INDEX CLEARED_SOURCE_SORTED_FAILURES ON FAILURE_MANAGER.FAILURES (cleared asc,SOURCE desc,ERRORNUMBER desc);
I sometimes still struggle with index definition. It seems odd to me that I have 3 different indexes, which all only differ in the second column. Relative to my described uses cases, are these indexes feasible or does this create unnecessary overhead? Are there any check up questions that I can ask my self to figure if this might be the correct setting?
Herr Derb
(113 rep)
Jun 13, 2018, 06:59 AM
• Last activity: Jun 13, 2018, 09:03 AM
2
votes
1
answers
201
views
How to aggregate datapoints in a table?
Suppose I have following table - CREATE TABLE data_points (t DATETIME PRIMARY KEY, value INTEGER); I want to aggregate the data by calculating average of every 10 points in the table. i.e. If table has 20 data points the result is two aggregate points. 1st aggregate point the average of 1-10 data po...
Suppose I have following table -
CREATE TABLE data_points (t DATETIME PRIMARY KEY, value INTEGER);
I want to aggregate the data by calculating average of every 10 points in the table.
i.e. If table has 20 data points the result is two aggregate points. 1st aggregate point the average of 1-10 data points, and 2nd of 11-20.
Is this possible using a SQL query?
Kshitiz Sharma
(3367 rep)
Dec 15, 2012, 08:13 AM
• Last activity: Dec 20, 2017, 01:50 PM
0
votes
2
answers
115
views
Regex rules engine based on SQL
I have a table which I use to determine actions based on conditions provided. This is what it looks like right now. IPAddress, MACAddress, Hostname, ScriptName, Argument1, Argument2, Argument3 10.2.1.* , .* , .* , diagnostics.sh, -runAll, , In this table, the first three columns are the conditions,...
I have a table which I use to determine actions based on conditions provided. This is what it looks like right now.
IPAddress, MACAddress, Hostname, ScriptName, Argument1, Argument2, Argument3
10.2.1.* , .* , .* , diagnostics.sh, -runAll, ,
In this table, the first three columns are the conditions, and the last four columns are the actions. Values of the condition cells are regex values that I do REGEX_LIKE on, so when I am looking up the correct script to run on a device, I look at it's IP (or MAC I'm given one or the other, not both) and hostname and if the regex matches, then I get the script name that needs to be run and arguments for that script.
Some scripts have one argument, some have two and others have three.
How do I modify this so I can an arbitrary list of conditions and actions. e.g. I am given a Key, Value map (attribute name, attribute value) for conditions, and once a rule has been satisfied, I retrieve a list of action Key, Value elements that are relevant for that device.
To keep things simple, there won't be any updates done to this database once it is initialized. It's initialized on start up by reading rules from a flat file, and the used at runtime to determine rules that have been satisfied for provided input.
This is the schema I think is better suited for this, but I don't know if this is correct and I don't know how to get the matching rules either.
Table Name: Column List
Attributes: attributeId, name, value
Conditions: conditionId, ruleId, attributeId
Actions : actionId, ruleId, attributeId
Rules : ruleId
McJagger
(3 rep)
Oct 27, 2017, 02:30 AM
• Last activity: Dec 7, 2017, 07:04 AM
1
votes
1
answers
2169
views
Will Derby, H2, or SQLite give faster load time and/or smaller file size than HSQL?
I have some flat files with the following columns; 3 integers, 3 reals, and 1 varchar(20). For querying I need an index that contains both 1 of the integer columns and the varchar column. Each file is around 1.8GB in size with around 38 million rows. Currently I am using a HSQL(Standalone) database...
I have some flat files with the following columns; 3 integers, 3 reals, and 1 varchar(20). For querying I need an index that contains both 1 of the integer columns and the varchar column. Each file is around 1.8GB in size with around 38 million rows.
Currently I am using a HSQL(Standalone) database to load a file for processing; one database per file. It is very slow to load (120+ min) the file and results in a 4.7GB database file when the database is created with the following options.
"Properties" -> {
"check_props" -> "true",
"shutdown" -> "true",
"hsqldb.default_table_type" -> "cached",
"sql.syntax_mss" -> "true",
"hsqldb.log_data" -> "false",
"hsqldb.inc_backup" -> "false"
}
The file read in batches of 100k records. The read is very fast (almost instant) so I do not think it is the read that is slowing things down. It also takes a very long time to close the connection to the database.
I have the option to use Derby, H2, or SQLite. Will any of these result in faster load time and/or smaller database file size in this scenario? If so what are the connection string options that should be used to achieve this? Alternatively, are there different connection string options I can use with HSQL(Standalone) that will reduce the load time and/or database file size?
Driver information added.
JDBCDriver[
"Name" -> "HSQL(Standalone)",
"Driver" -> "org.hsqldb.jdbcDriver",
"Protocol" -> "jdbc:hsqldb:file:",
"Version" -> 3.1,
"Description" -> "HSQL Database Engine (In-Process Mode) - Version 2.3.3 - This ...",
"Location" -> "C:\... "]
Driver information for the other options available to me.
Derby
JDBCDriver[
"Name" -> "Derby(Embedded)",
"Driver" -> "org.apache.derby.jdbc.EmbeddedDriver",
"Protocol" -> "jdbc:derby:",
"Version" -> 3.1,
"Description" -> "Derby Database Engine (Embedded Mode) - Version 10.12.1.1 - This...",
"Location" -> "C:\... "]
H2
JDBCDriver[
"Name" -> "H2(Embedded)",
"Driver" -> "org.h2.Driver",
"Protocol" -> "jdbc:h2:",
"Version" -> 3.1,
"Description" -> "H2 Database Engine (Embedded Mode) - Version 1.3.176 - This...",
"Location" -> "C:\... "]
SQLite
JDBCDriver[
"Name" -> "SQLite",
"Driver" -> "org.sqlite.JDBC",
"Protocol" -> "jdbc:sqlite:",
"Version" -> 3.1,
"Description" -> "SQLite using Zentus-derived JDBC Driver - Version 3.8.11.2",
"Location" -> "C:\..."]
Additional variants include the below. However, I need it all to run on the client's computer. I believe this excludes server and webserver modes.
{"Derby(Embedded)", "Derby(Server)", "H2(Embedded)", "H2(Memory)",
"H2(Server)", "HSQL(Memory)", "HSQL(Server)", "HSQL(Standalone)",
"SQLite", "SQLite(Memory)"}
Edmund
(733 rep)
Mar 21, 2017, 12:35 PM
• Last activity: Mar 24, 2017, 05:46 PM
2
votes
0
answers
1036
views
Does H2 Database support pessimistic locking?
Does the [H2 Database][1] support pessimistic locking? If so, how does its use interact with H2’s [MVCC][2] implementation? I'm not looking for advice on whether or not to use pessimistic locking. I have a specific need to emulate the behavior of another database that defaults to row-level pessimist...
Does the H2 Database support pessimistic locking?
If so, how does its use interact with H2’s MVCC implementation?
I'm not looking for advice on whether or not to use pessimistic locking. I have a specific need to emulate the behavior of another database that defaults to row-level pessimistic locking. I need to be able to test if a row is locked, and if not locked, lock it out from writes by any other database connection.
Basil Bourque
(11188 rep)
Feb 2, 2017, 03:15 AM
1
votes
2
answers
437
views
Application testing: using multiple users in Oracle instead of mem H2. How to make it as fast as possible?
I decided to stop using H2 for obvious reasons (I have Oracle on production, compatibility mode is a fake). So, I wrote simple test framework which for each test in my application does the following: 1. Generate random username (in example below it's `test_user`). 2. Create new user and tablespace:...
I decided to stop using H2 for obvious reasons (I have Oracle on production, compatibility mode is a fake). So, I wrote simple test framework which for each test in my application does the following:
1. Generate random username (in example below it's
test_user
).
2. Create new user and tablespace:
create tablespace test_user_ts
datafile 'test_user_tabspace.dat'
size 10M reuse
autoextend on next 500K;
create temporary tablespace test_user_ts_tmp
tempfile 'test_user.tabspace_temp.dat'
size 10M reuse
autoextend on next 500K;
create user test_user
identified by test_password
default tablespace test_user_ts
temporary tablespace test_user_ts_tmp;
grant create session to test_user;
grant all privileges to test_user;
4. Populate database with test data.
5. Run test.
6. Clean up:
drop user test_user cascade;
drop tablespace test_user_ts_tmp;
drop tablespace test_user_ts;
**The problem is that stages 1-3 are slow. How can I make them as fast as possible?** Is there maybe any way of _copying_ existing db schema to another one?
Db version: Oracle 11g
I have full control over Oracle instance. It runs on a vagrant image on my dev machine.
whysoserious
(113 rep)
Dec 29, 2014, 07:56 AM
• Last activity: Dec 30, 2014, 12:06 AM
4
votes
1
answers
1925
views
CTE returns an empty set even though anchor is non-empty
I'm got an [adjacency list](https://stackoverflow.com/q/4048151/14731) consisting of two tables: CREATE TABLE permission (id SMALLINT AUTO_INCREMENT(-32768, 1) PRIMARY KEY); CREATE TABLE permission_graph (parent_id SMALLINT NOT NULL, child_id SMALLINT NOT NULL, UNIQUE KEY (parent_id, child_id), FORE...
I'm got an [adjacency list](https://stackoverflow.com/q/4048151/14731) consisting of two tables:
CREATE TABLE permission (id SMALLINT AUTO_INCREMENT(-32768, 1) PRIMARY KEY);
CREATE TABLE permission_graph (parent_id SMALLINT NOT NULL, child_id SMALLINT NOT NULL,
UNIQUE KEY (parent_id, child_id),
FOREIGN KEY (parent_id) REFERENCES permission(id) ON DELETE CASCADE,
FOREIGN KEY (child_id) REFERENCES permission(id) ON DELETE CASCADE);
When I run the following [CTE](http://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL#Common_table_expression) I get an empty set:
WITH RECURSIVE cte (parent_id, child_id)
AS
(
(
SELECT anchor.parent_id, anchor.child_id
FROM permission_graph anchor
WHERE anchor.child_id = -32763
)
UNION ALL
(
SELECT recursive.parent_id, recursive.child_id
FROM cte, permission_graph recursive
WHERE recursive.child_id = cte.child_id
)
)
SELECT cte.parent_id, cte.child_id
FROM cte
But if I run the anchor condition:
SELECT anchor.parent_id, anchor.child_id
FROM permission_graph anchor
WHERE anchor.child_id = -32763
I get:
[parent_id = -32767, child_id = -32763]
[parent_id = -32768, child_id = -32763]
**Why is the CTE returning an empty set when the anchor result is non-empty?** Shouldn't the CTE result contain the anchor result?
Gili
(1059 rep)
Oct 6, 2014, 04:38 AM
• Last activity: Oct 6, 2014, 01:52 PM
2
votes
3
answers
14192
views
Alternatives for a LEFT OUTER JOIN query
## Problem ## I have a SQL statement with an `LEFT OUTER JOIN` which works fine on our `Microsoft SQL Server`. My problem is that i have to be compatible with `H2 Database` and this one got a bug with `OUTER JOINS`. ---------- ## SQL Query ## SELECT * FROM tSysNls WHERE nlsGuid IN ( SELECT nlsGuid =...
## Problem ##
I have a SQL statement with an
LEFT OUTER JOIN
which works fine on our Microsoft SQL Server
. My problem is that i have to be compatible with H2 Database
and this one got a bug with OUTER JOINS
.
----------
## SQL Query ##
SELECT *
FROM tSysNls
WHERE nlsGuid IN
( SELECT nlsGuid = CASE
WHEN de_AT.nlsGuid IS NOT NULL THEN de_AT.nlsGuid
WHEN de.nlsGuid IS NOT NULL THEN de.nlsGuid ELSE en.nlsGuid
END
FROM tSysNLS en
LEFT OUTER JOIN tSysNLS de ON en.nlsAttribute=de.nlsAttribute
AND en.nlsClazz=de.nlsClazz
AND de.nlsLocale= 'de'
LEFT OUTER JOIN tSysNLS de_AT ON de.nlsAttribute=de_AT.nlsAttribute
AND de.nlsClazz=de_AT.nlsClazz
AND de_AT.nlsLocale= 'de_AT'
WHERE en.nlsLocale= 'en'
AND en.nlsClazz= 'Contact'
AND en.nlsAttribute= 'firstName')
----------
## Table ##
CREATE TABLE tsysNLS
(
nlsGuid nvarchar(207) NOT NULL,
nlsLocale nvarchar(5) NOT NULL,
nlsClazz nvarchar(100) NOT NULL,
nlsAttribute nvarchar(100) NOT NULL,
nlsDisplayName nvarchar(255) NOT NULL,
nlsOldname nvarchar(50),
nlsDescription nvarchar(255),
nlsShapefilename nvarchar(10)
);
----------
## Example data ##
INSERT INTO tsysNLS(nlsGuid, nlsLocale, nlsClazz, nlsAttribute, nlsDisplayName, nlsOldname, nlsDescription, nlsShapefilename)
VALUES(N'Contact.firstName.en', N'en', N'Contact', N'firstName', N'Name - First Name', N'conFirstName', N'Name - First Name', NULL);
INSERT INTO tsysNLS(nlsGuid, nlsLocale, nlsClazz, nlsAttribute, nlsDisplayName, nlsOldname, nlsDescription, nlsShapefilename)
VALUES(N'Contact.firstName.de', N'de', N'Contact', N'firstName', N'Vorname', N'conFirstName', NULL, N'ConNamVor');
INSERT INTO tsysNLS(nlsGuid, nlsLocale, nlsClazz, nlsAttribute, nlsDisplayName, nlsOldname, nlsDescription, nlsShapefilename)
VALUES(N'Contact.firstName.de_AT', N'de_AT', N'Contact', N'firstName', N'Vorname (AT)', N'conFirstName', NULL, N'ConNamVor');
lumo
(445 rep)
Sep 22, 2014, 12:51 PM
• Last activity: Sep 26, 2014, 05:34 AM
2
votes
0
answers
1119
views
Is there a way to detect if there is an uncommitted transaction in H2?
I am using an H2 database with JDBC to create a connection with setAutoCommit(false). I am currently programatically checking whether or not there is an uncommitted transaction, but I was wondering if there was a way to directly query H2 for information about this state. I have found some informatio...
I am using an H2 database with JDBC to create a connection with setAutoCommit(false).
I am currently programatically checking whether or not there is an uncommitted transaction, but I was wondering if there was a way to directly query H2 for information about this state.
I have found some information for other databases on this topic, but nothing so far on H2.
Bri
(195 rep)
Feb 27, 2014, 02:32 AM
1
votes
0
answers
56
views
parenthetic grouping of join clauses
What is the difference between these joins? 1. a left join b left join c 2. (a left join b) left join c 3. a left join (b left join c) Does the grouping only affect the order of the joins? Will the query engine decompose #1 into one of #2 or #3, i.e. pick an order for doing the joins? I'm asking bec...
What is the difference between these joins?
1. a left join b left join c
2. (a left join b) left join c
3. a left join (b left join c)
Does the grouping only affect the order of the joins? Will the query engine decompose #1 into one of #2 or #3, i.e. pick an order for doing the joins?
I'm asking because h2 uses indexes on c for #1, but for #2 does a table scan of c.
Here b is a simple many-to-many join table with columns (a_id, c_id).
user1009908
(111 rep)
Apr 20, 2013, 09:58 PM
• Last activity: Apr 20, 2013, 10:41 PM
0
votes
1
answers
3194
views
H2 SELECT NULLABLE or other equivalent to check a column has NOT NULL constraint or not
I would like to check if a column has a NOT NULL constraint in order to start an automated upgrade of the table definition. However in H2 the SQL `SELECT NULLABLE FROM TABLE_NAME` doesn't return me the NOT NULL columns and I don't seem to find anything similar to check the constraint on the table co...
I would like to check if a column has a NOT NULL constraint in order to start an automated upgrade of the table definition.
However in H2 the SQL
SELECT NULLABLE FROM TABLE_NAME
doesn't return me the NOT NULL columns and I don't seem to find anything similar to check the constraint on the table columns.
Notice I don't want to check the NOT NULL column values with something like SELECT COLUMN FROM TABLE WHERE COLUMN IS NOT NULL
! I want to check the table definition for that specific column.
thank you
dendini
(395 rep)
Mar 28, 2013, 09:31 AM
• Last activity: Mar 28, 2013, 09:48 AM
Showing page 1 of 17 total questions