I am writing a single query to insert data into 2 tables using “WITH AS”. The query works fine on Postgres but on H2 database it is throwing syntax error. I have 2 tables. Table 1 has 2 columns — a Primary Key table1_ID and a table1_value column. Table 2 has 3 columns — a PK table2_Id and table2_value and
Tag: h2
Jooq insert one2one and one2many relational data into 2 tables at once. How to deal with issues and rollback
F.e. model How to insert it at once in jooq? How to deal with rollback if some query will fail? Is it has to be programated on my side? I can not find a word about such case in documentation 🙁 Should Id do it manually like: find author id in db by name if author not exist insert new
Single quotes cause trouble while filtering in Slick
I have statements such as below and they fail with exceptions such as this I have tried to escape the single quote but wasn’t successful. When I tried to insert a record such as this: The exception I’ve gotten is: Please note that I am using H2 in Mysql mode to run my tests. Answer That error suggests to me
H2 vs PostgreSQL generated column with function
I’m trying to setup a generated column which will also take null checks into consideration when subtracting values. In PostgreSQL I did: ALTER TABLE session ADD COLUMN duration INTERVAL GENERATED …
Will Converting my H2 memory database to a SQL database mess up any actual logic on my project? Spring Boot
I am currently using the H2 memory database for my website. Everything is working so far but to progress my teacher said to transition from the h2 database to a SQL since it resets everytime you restart the program. I was wondering if I transitioned, would it mess up any of my logic / code. I know I would have
Is it possible to access application properties from schema.sql?
I want to make a date type variable. Locally I am using a h2-database. But I am deploying into a cloud with a Hana DB. Hana has the exact Date format I am needing: SECONDDATE (YYYY-MM-DD HH24:MI:SS). …
H2 Db, ID NextVal
I have a sequence as: CREATE SEQUENCE OWNER_SEQ START WITH 1; I need to trigger this sequence for OWNER table’s ID column CREATE TABLE METADATA.OWNER ( OWNER_ID NUMBER NEXTVAL(…
Matching literal percent in h2/postgres?
I have the following value in a db column: some%thing I’m using h2 and postgres, but can’t figure out why this query, where I have escaped the % to perform a literal search, is not matching the row …
H2 database – Update from select sets out-of-date data after h2database upgrade to version 1.4.198
We have a simple counter in out project database. Until now we were using version 1.4.197 of H2 database. Executing below example snippet with this version always imply counter to be 5000. Upgrade to version 1.4.198 or above makes below code returning inconsistent results, usually between 1500 and 2000. My assumption is that the select statement from below SQL is
H2 org.h2.jdbc.JdbcSQLSyntaxErrorException occurs when executing a script file in a h2 database
I have used java -cp h2-1.4.199.jar org.h2.tools.RunScript -url jdbc:h2:mem:db1 -script infra_params.sql command to execute below sql script in a H2 database. infra_params.sql file:- DROP TABLE IF …