[h2] Re: Function calls with parameters

2020-08-18 Thread Evgenij Ryazanov
> > CAST(? AS INTERVAL(18) DAY) > I meant CAST(? AS INTERVAL DAY(18)) -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com.

[h2] Re: Function calls with parameters

2020-08-18 Thread Evgenij Ryazanov
Hello. 1. You can't legally use expressions as the first parameter of this function, H2 officially supports only datetime fields: https://h2database.com/html/functions.html#datediff The valid syntax is TIMESTAMPDIFF(HOUR, arg1, arg2). H2 accepts character string literals too for some limited

Re: [h2] Re: CustomDataTypesHandler

2020-08-07 Thread Evgenij Ryazanov
There is no such data type in the SQL Standard and such data type is quite exotic even for general purpose programming languages. I don't see any good reasons to have it in H2. These numbers are usually stored in two columns or as a character string value. You can also use JAVA_OBJECT data

[h2] Re: Is it safe to writing data when a backup ongoing?

2020-08-07 Thread Evgenij Ryazanov
Hello. BACKUP command of H2 works only with persistent databases. You can't use it with in-memory database. You can try to use the SCRIPT command, it works with both persistent and in-memory databases, but it doesn't ensure consistency if some concurrent transaction commits its data. -- You

[h2] Re: CustomDataTypesHandler

2020-08-06 Thread Evgenij Ryazanov
Hello. It's a long story. Apache Ignite used released versions of H2 internally. Because it needed more than H2 can provide, some new functionality were contributed to H2, usually without taking own needs of H2 into account. Some of this functionality wasn't used by H2 itself and other

[h2] Re: database(dbms) replicate sort order in ascending and descending from all data strcture for fast query?

2020-08-02 Thread Evgenij Ryazanov
Hello. H2 currently can use index-sorted optimization only when there is a compatible index with the same order. But you can create indexes with different order on the same columns. CREATE TABLE TEST(A INT, B INT); CREATE INDEX IDX1 ON TEST(A, B); CREATE INDEX IDX2 ON TEST(A, B DESC); EXPLAIN

[h2] Re: Can LINK_SCHEMA always output the list of linked tables

2020-07-31 Thread Evgenij Ryazanov
This function is not intended to be called by regular users. Even more, you should never give ADMIN privileges to users, especially in H2 where users with such privileges have access to the server and may interact with operating system. H2 is not a secure container. DBAs should see what

[h2] Re: Can LINK_SCHEMA always output the list of linked tables

2020-07-31 Thread Evgenij Ryazanov
I don't see any good reasons for such modifications in H2. Result of this function can be ignored by application. JDBC doesn't require you to read result of a query. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this

[h2] Re: Can LINK_SCHEMA always output the list of linked tables

2020-07-31 Thread Evgenij Ryazanov
No, it can't. But you can filter out all rows from its result. SELECT * FROM LINK_SCHEMA('PUBLIC', '', 'jdbc:h2:mem:2', 'sa', '', 'PUBLIC') WHERE FALSE; -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop

[h2] Re: Oracle mode - trunc(date, datePart) does not work in 1.4.200

2020-07-30 Thread Evgenij Ryazanov
Hello. H2 never had real support of Oracle-style TRUNC function. H2 has only own function and its optional second argument is a number of digits. Recent releases of H2 are more pedantic and they correctly reject the second argument when it isn't supported due to type of the first argument, I

[h2] Re: H2 Triggers and Classes

2020-07-25 Thread Evgenij Ryazanov
Hello. You really should use an identity column instead of sequence with such trigger in both Oracle and H2 instead of all these complications with triggers. But if you need to execute some more complicated actions in the trigger, you need to write an own class with implementation of

[h2] Re: case sensitivity with field names broke with version 1.4.198

2020-07-22 Thread Evgenij Ryazanov
Hello. In old versions of H2 there was only one setting for case of identifiers. With DATABASE_TO_UPPER=FALSE unquoted identifiers aren't converted to upper case and all identifiers are not case sensitive. In new versions of H2 there are three separate settings. DATABASE_TO_UPPER,

[h2] Re: Access auditing

2020-07-19 Thread Evgenij Ryazanov
Hello. Users of application server and users of database are not related in any way. If you use H2 Console servlet in production server, you must add a security constraint for it, otherwise you can create a security hole in your system, especially if you use some old version of H2. It looks

[h2] Re: New Install Startup Question

2020-07-19 Thread Evgenij Ryazanov
Hello. There is no default username and there is no default password. You need to specify some by yourself when you create a new database. If you opened the H2 Console, you need to specify JDBC URL, some username and password, these username and password will be used to create a user with

[h2] Re: mvstore

2020-07-14 Thread Evgenij Ryazanov
Hello. 1. MVStore is also released separately. https://search.maven.org/artifact/com.h2database/h2-mvstore 2. There are some plans to stop its separate releases. https://github.com/h2database/h2database/issues/2742 -- You received this message because you are subscribed to the Google Groups

[h2] Re: Can I just ignore do close for Connection/PreparedStatement/ResultSet) when I use h2 in-memory mode?

2020-07-12 Thread Evgenij Ryazanov
Hello. If you don't use DB_CLOSE_DELAY setting all these objects can be garbage collected, but it's a bad practice anyway. If you use it, it may prevent deletion of database when all connections were closed or garbage collected, so it can create a memory leak. -- You received this message

[h2] Re: NullpointerException

2020-07-12 Thread Evgenij Ryazanov
build.cmd jar (or ./build.sh jar on Linux, OS X, etc.) in h2 subdirectory produces jar file with exactly the same content as included into official releases in bin/h2-***.jar. It has H2 Console and command-line Shell tool, so I don't understand what do you mean by tools. > > You need Java 8, 9,

[h2] Re: NullpointerException

2020-07-11 Thread Evgenij Ryazanov
Hello. It looks like you're trying to execute multiple commands at once and you have a table value constructor after some data definition command: try (Connection c = DriverManager.getConnection("jdbc:h2:mem:1")) { c.createStatement().execute("CREATE TABLE TEST(); VALUES 1"); } H2 returns

[h2] Re: performance falling to very slow when use order by, even if the order by columns has indexed.

2020-07-06 Thread Evgenij Ryazanov
No, you can't rely on such behavior. For example, it will be broken in you'll add a smaller index with symbol and side columns. I missed, however, the WHERE clause in your query. With such clause when only one value is allowed in symbol column and only one value is allowed in side column your

[h2] Re: performance falling to very slow when use order by, even if the order by columns has indexed.

2020-07-06 Thread Evgenij Ryazanov
Hello. You need an index on (orderingpx, serial) columns. Index on (symbol, side, orderingpx, serial) columns can't be used by order by orderingpx, serial, because such index is ordered by symbol, side, …. -- You received this message because you are subscribed to the Google Groups "H2

[h2] Re: Will a H2 v1.4.200 jar file read/open a database created by H2 V1.3.x ?

2020-06-28 Thread Evgenij Ryazanov
Hello. Yes, there are known issues and most likely they will not be fixed, development of legacy PageStore backend was stopped many years ago, only few changes were applied since then. Versions before 1.4.197 use incorrect indexes for referential constraints in some cases, this issue was

[h2] Re: Is there a way to get a column remarks from a table

2020-06-11 Thread Evgenij Ryazanov
Hello. Subqueries with exactly one row can be used as expressions. INSERT INTO MYTABLE VALUES ((SELECT REMARKS FROM … WHERE TABLE_NAME = … AND COLUMN_NAME = 'A'), (SELECT … WHERE …)); -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To

[h2] Re: Integration tests: connection to tcp server from two processes does not work

2020-06-10 Thread Evgenij Ryazanov
You must specify a TCP password to use the shutdownTcpServer() due to security reasons. https://h2database.com/html/tutorial.html#using_server -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving

[h2] Re: Integration tests: connection to tcp server from two processes does not work

2020-06-10 Thread Evgenij Ryazanov
Hello. Why you're using -tcpAllowOthers? Do you really need to connect to your testing system from other hosts? Combination of this setting with -ifNotExists effectively creates a remote security hole on your system, -ifNotExists should not be normally used even for local connections, local

[h2] Re: JSONREAD. Can it be supported similarly to CSVREAD?

2020-05-29 Thread Evgenij Ryazanov
You can parse JSON with GSON, FasterXML/jackson, javax.json, or some other library. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: JSONREAD. Can it be supported similarly to CSVREAD?

2020-05-29 Thread Evgenij Ryazanov
You need JSON_TABLE for it, but it isn't implemented yet and AFAIK nobody works on its implementation. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: JSONREAD. Can it be supported similarly to CSVREAD?

2020-05-29 Thread Evgenij Ryazanov
Hello. If you simply want to read a JSON from a file, use CAST(FILE_READ('/path/to/file.json') AS VARBINARY) FORMAT JSON or something like it. You can't convert a BLOB to JSON directly, but you can use VARBINARY in the middle. If you want to inspect structure of JSON, you need to use some

[h2] Re: new created database is not visible between connections

2020-05-28 Thread Evgenij Ryazanov
1. In H2 (and many others) database and schema are different things. Database may have multiple schemas. 2. Each database has own connection URL. You can't use multiple URLs in one connection pool and can't use multiple databases in the one pool. Each database must have own connection pool.

[h2] Re: new created database is not visible between connections

2020-05-26 Thread Evgenij Ryazanov
What exactly do you want? Use the *same* database it all connections? Then choose some name for your in-memory database and pass JDBC URL with this name to your pool. Don't use jdbc:h2:mem:; use jdbc:h2:mem:something; And don't use DATABASE_TO_UPPER=FALSE parameter if you need some

[h2] Re: new created database is not visible between connections

2020-05-26 Thread Evgenij Ryazanov
Then you need to generate some name for it and pass this name to all connections. Use some counter, for example. Don't forget about lifecycle of your in-memory databases. By default, they are removed when all connections to the specific database were closed. But when you're using

[h2] Re: new created database is not visible between connections

2020-05-26 Thread Evgenij Ryazanov
If your JDBC URL is jdbc:h2:mem: the database will be private to the connection, if this URL will be specified in another connection, this another connection will have another private database not related with the first one. If your JDBC URL is jdbc:h2:mem:someDatabaseName the database will be

[h2] Re: new created database is not visible between connections

2020-05-26 Thread Evgenij Ryazanov
Hello. Please, read mentioned by you on GitHub section of documentation again, especially after words > Sometimes multiple connections to the same in-memory database are required https://h2database.com/html/features.html#in_memory_databases -- You received this message because you are

[h2] Re: Changing H2 mode from Oracle to PostgreSQL results in different values for TIMESTAMP and NUMBER?

2020-05-19 Thread Evgenij Ryazanov
Hello. It looks like you use some outdated version of H2, because MVCC setting doesn't exist in recent releases. PostgreSQL doesn't have the NUMBER data type, and this type is not a native type of H2 too, why you use it? It is from Oracle, H2 accepts it, but only for compatibility with

[h2] Re: How to extract data from json field in h2 db

2020-05-18 Thread Evgenij Ryazanov
Hello. H2 doesn't have any built-in JSON decomposition functions yet, you can only write an own user-defined function for such purpose that can use some third-party JSON library. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe

[h2] Re: Multi column index vs compact single column index

2020-05-18 Thread Evgenij Ryazanov
Hello. Queries like SELECT * FROM SOME_TABLE WHERE COUNTRY = something AND STATE = something and similar will be able to use a normal multi-column index if *first* columns of this index are COUNTRY and STATE. There is no reason for additional weird indexed computed combined column, such column

[h2] Re: Cannot Login to H2 Console (Fresh Install)

2020-05-18 Thread Evgenij Ryazanov
1. Databases usually need more space than CSV. You need to use a normal file-based database (jdbc:h2:/path/to/database) instead of in-memory one. 2. Built-in CSVREAD() function in recent versions of H2 reads all data into memory too. If I remember it well, its on-disk buffering was removed due

[h2] Re: Cannot Login to H2 Console (Fresh Install)

2020-05-17 Thread Evgenij Ryazanov
There is a Max rows combobox on the top. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To view this discussion on the

[h2] Re: Cannot Login to H2 Console (Fresh Install)

2020-05-17 Thread Evgenij Ryazanov
Create a new database... command is not designed to create an in-memory database, it is for persistent databases only. Actually you can create an in-memory database with it, but it is removed immediately, because there are no active connections. You can use mem:testdb;DB_CLOSE_DELAY=-1 to

[h2] Re: Cannot Login to H2 Console (Fresh Install)

2020-05-16 Thread Evgenij Ryazanov
Hello. You are not connected to H2 Console, this port is used by some other application. You should have .h2.server.properties file in the home directory of your user. Open it with some text editor, find the line webPort=8082 and change the port number to a some free port. Then restart the H2

[h2] Re: How to make H2 file-based for Spring Boot

2020-05-05 Thread Evgenij Ryazanov
Hello. It looks like you already have a database with the name *test* in your home directory and this database has a user with some name and password; you need to specify them. If you don't know them, you can try to use the recovery tool, but if you don't need data in this database, you can

[h2] Re: Foreign key constraint tied to same index generated for a unique constraint that uses that index

2020-04-30 Thread Evgenij Ryazanov
By “current H2” I meant current sources of H2 on GitHub. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To view this

[h2] Re: "SCRIPT SIMPLE DROP" won't generate DROP statements for system sequences - should it?

2020-04-28 Thread Evgenij Ryazanov
Hello. SCRIPT command has many flaws, but system sequences are going to be reimplemented together with identity columns when I or somebody else will find time to write a better implementation. https://github.com/h2database/h2database/issues/2339 This command, however, is not designed for such

[h2] Re: Foreign key constraint tied to same index generated for a unique constraint that uses that index

2020-04-24 Thread Evgenij Ryazanov
Hello. Indexes may be shared between constraints. In the SQL Standard referential constraints may reference only columns with already existing unique constraint. It isn't ensured by released versions of H2, they allow referential constraints without unique constraints and reuse their indexes.

[h2] Re: Status of PostgreSQL ODBC support

2020-04-21 Thread Evgenij Ryazanov
Hello. I guess only few people really use it. If some SET commands fail, you can add some dummy implementations for them here: https://github.com/h2database/h2database/blob/93f51bf336de1ce7af598f890a6557052c1d6dc4/h2/src/main/org/h2/command/Parser.java#L8371 But you may run into some much more

Re: [h2] Group BY on "large" tables from file-system causes Out of Memory Error

2020-04-21 Thread Evgenij Ryazanov
H2 doesn't need a lot of memory for plain queries without aggregate and window functions, large results are stored on the disk automatically. But queries with aggregate or window functions currently need to load the whole result into the memory; the only exclusion is the mentioned optimization

[h2] Re: Group BY on "large" tables from file-system causes Out of Memory Error

2020-04-21 Thread Evgenij Ryazanov
Hello. If you don't have an index on GROUP BY column, you need a lot of memory for such queries in H2. You can use the EXPLAIN command to check whether optimization is used or not. create table result(id bigint, name varchar, phone int); -- Without optimization explain select id, sum(phone)

[h2] Re: Changed behavior for NOT NULL columns with default values

2020-04-14 Thread Evgenij Ryazanov
Don't rely on that undocumented feature, it is a hidden internal part of archaic implementation of identity columns, most likely it will be removed in the future. You really should fix your command instead, it currently abuses an old bug of MySQL. -- You received this message because you are

[h2] Re: Changed behavior for NOT NULL columns with default values

2020-04-13 Thread Evgenij Ryazanov
Hello. Your command is obliviously invalid. You can't insert a NULL into column with NOT NULL constraint. You need to use DEFAULT INSERT INTO test_table(column1, update_time) VALUES ('test', DEFAULT); or you can simply remove this column from the list of INSERT columns. INSERT INTO

[h2] Re: unable to create linked table on hive database/tables

2020-04-12 Thread Evgenij Ryazanov
Hello. H2 needs to know some information about the linked database to work with its tables. Each JDBC driver must implement these basic methods. You need to report your problem as an issue with Apache Hive it its bugtracker: https://issues.apache.org/jira/projects/HIVE/issues There is nothing

[h2] Re: version of JDBC API

2020-04-09 Thread Evgenij Ryazanov
Hello. In depends on version of H2. You should use DatabaseMetaData.getJDBCMajorVersion() and DatabaseMetaData.getJDBCMinorVersion() to detect its announced version. For example, H2 1.4.200 returns 4.1, in the current sources of H2 the returned version is 4.2. But this version has a very low

[h2] Re: Generic Jdbc oracle driver for H2

2020-04-01 Thread Evgenij Ryazanov
> > I´m using H2 DB with a JDBC Driver to Oracle, and It´s working now. No, you aren't. It only means that you use some entirely outdated version of H2, such as 1.4.197 or older. H2 Console in these versions doesn't throw any error about incorrect driver in that case, but silently uses the

[h2] Re: Generic Jdbc oracle driver for H2

2020-03-27 Thread Evgenij Ryazanov
Hello. You can use Oracle's driver only when you work with Oracle Database and you can use H2's driver only when you work with H2 Database. You can't use driver for one database with another. Both drivers are available on Maven Central and in other places:

[h2] Re: Protection against H2 file corruption

2020-03-17 Thread Evgenij Ryazanov
Hello. You need to post a complete stack trace, first few lines don't contain enough information about your problem. You can try to use a more recent version of H2 or even try to build H2 from its current sources, current H2 is more reliable than 1.4.197. You can also try to use the legacy

[h2] Re: Is it possible to view/edit MVStore-entries in H2 console?

2020-03-11 Thread Evgenij Ryazanov
Hello. No, it isn't possible. H2 Console is a tool that works only with databases. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: How to migrate h2 v1.2.142 to h2 v1.4.x

2020-03-11 Thread Evgenij Ryazanov
Hello. Use the recommended procedure with SCRIPT TO 'filename.sql' in your old version of H2, creation of a new database in the new version, and RUNSCIPT FROM 'filename.sql' in it. https://h2database.com/html/tutorial.html#upgrade_backup_restore Because there is a huge difference between

[h2] Re: Do custom TableEngines require storage to be sorted?

2020-03-09 Thread Evgenij Ryazanov
Hello. Scan index may return all rows from the find() method (but it should also return true from isFindUsingFullTableScan()). Order of elements in the index is not used in this case if index is not returned from Table.getIndexes(). If you can efficiently lookup rows by values in some

[h2] Re: Schema design: array type vs. normalised?

2020-03-07 Thread Evgenij Ryazanov
Hello. When database reads a row from a table, the whole row is constructed and all its values are read, with exception for large CLOB and BLOB objects. It means that query like SELECT id FROM route2 WHERE name LIKE '%something%' will read a lot of unnecessary data from waypoints column. Not

[h2] Re: 1.4.200: create temporary linked table failed, where urlString is set in variable, but the same string, as set in variable, pasted into urlString is OK

2020-03-02 Thread Evgenij Ryazanov
Hello. DDL (data definition language) commands in H2 don't support any parameters. The SQL Standard also does not specify such support in any way. You can construct and execute a non-query commands dynamically: https://h2database.com/html/commands.html#execute_immediate EXECUTE IMMEDIATE

Re: [h2] Re: Does H2 support column compression?

2020-02-27 Thread Evgenij Ryazanov
You can enable the compression only for the whole database, but it can reduce overall performance. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: Does H2 support column compression?

2020-02-27 Thread Evgenij Ryazanov
Hello. It sounds like your database is not normalized properly. I suggest you to read a some book about database design or at least some articles about database normalization. For your specific use case you need to extract all possible values for each such column into own table that has a

[h2] Re: How to INSERT a row if the data doesn't exist or fetch id if it does?

2020-02-18 Thread Evgenij Ryazanov
There is a UNION between two queries. One of them is a simple lookup, it returns a row only if it exists. Another one is a query from a data change delta table from the results of inner MERGE command that tries to merge a temporary table with the one row (VALUES ?) into the target table.

[h2] Re: How to INSERT a row if the data doesn't exist or fetch id if it does?

2020-02-18 Thread Evgenij Ryazanov
Try INSERT INTO Questions VALUES ( ?, ?, (WITH S(NAME) AS (VALUES ?) SELECT id FROM QuestionTypes JOIN S ON QuestionTypes.name = S.NAME UNION SELECT id FROM FINAL TABLE ( MERGE INTO QuestionTypes T USING S ON T.name = S.NAME WHEN NOT MATCHED THEN INSERT

[h2] Re: How to INSERT a row if the data doesn't exist or fetch id if it does?

2020-02-18 Thread Evgenij Ryazanov
Hello. What exactly do you want? Do you know the id of QuestionBanks? Or you know only its name and want to lookup the id for the known name of insert a new row with such name? If so, you can execute something like WITH S(NAME) AS (VALUES ?) SELECT id FROM QuestionBanks JOIN S ON

[h2] Re: suggestion/feature request CSVREAD respect column names

2020-02-13 Thread Evgenij Ryazanov
On Thursday, 13 February 2020 22:33:48 UTC+8, Rinse Lemstra wrote: > > Although the csv file does containt column names, they are not respected. > Hello. The documentation of this function describes how to use custom names or use column names from the file:

[h2] Re: CSVREAD looses column (1.4.196)

2020-02-05 Thread Evgenij Ryazanov
Hello. CSVREAD needs many other changes and I don't have time for them right now. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: MS SQL Date Functions

2020-02-05 Thread Evgenij Ryazanov
Hello. You can create user-defined functions with such names by using the CREATE ALIAS command: https://h2database.com/html/commands.html#create_alias -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop

[h2] Re: Documentation to build and run the source code

2020-02-04 Thread Evgenij Ryazanov
Hello. Building instructions are here: https://h2database.com/html/build.html#building Use the jar target. You need Java 8, 9, 10, 11, or 12. You can set the JAVA_HOME environment variable to a path to installation of appropriate JDK. Java 13 and later versions can't be currently used by the

[h2] Re: How to connect H2 Database Engine GUI

2020-02-04 Thread Evgenij Ryazanov
Hello. Just launch the jar and you'll get a browser window where you'll be able to login into an existing or a new database. https://h2database.com/html/tutorial.html#tutorial_starting_h2_console -- You received this message because you are subscribed to the Google Groups "H2 Database"

[h2] Re: Oracle mode - trunc(date, datePart) does not work in 1.4.200

2020-01-29 Thread Evgenij Ryazanov
Hello. I guess you meant 1.4.197. This function with such parameters was never supported by H2. But H2 silently ignores the value of the second parameter if the first parameter is a DATE, TIMESTAMP, or TIMESTAMP WITH TIME ZONE. The code for these data types is the same in both versions:

[h2] Re: H2 DB corruption

2020-01-24 Thread Evgenij Ryazanov
Hello. The BACKUP command most likely is not related (if it isn't invoked by another process with different version of H2). But there are three suspicious options in your connection URL. 1. If you use the retry: subsystem, I assume that you interrupt your threads that perform calls into

[h2] Re: PostgreSQL compatibility JUnit

2020-01-23 Thread Evgenij Ryazanov
You can also create a user-defined function with name pg_get_serial_sequence and execute the inner query in it, if you wish. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send

[h2] Re: PostgreSQL compatibility JUnit

2020-01-23 Thread Evgenij Ryazanov
Hello. In general case, if you want to use multiple databases, you should use only standard SQL features. However, the SQL Standard does not provide any way to fetch the current value of the sequence. Such operation has very low meaning. There are other ways to fetch the generated value during

[h2] Re: cannot start h2 services

2020-01-23 Thread Evgenij Ryazanov
Hello. Windows distribution of H2 comes with a completely outdated 32-bit service wrapper, it needs a 32-bit JDK (not available for recent versions of Java). You can use some other third-party service wrapper, such as Procrun: https://commons.apache.org/proper/commons-daemon/procrun.html It has

[h2] Re: Any advantage in using LocalDateTime binding

2020-01-21 Thread Evgenij Ryazanov
Hello. No, they don't use any wrappers in latest versions of H2, they all are handled by own implementations in H2. Actually legacy java.util.* and java.sql.* data types have different bugs in Java; don't use them if you can. Documentation of H2 also recommends JSR-310 data types:

[h2] Re: exception using IN filter with multiple columns, when data contains null

2020-01-03 Thread Evgenij Ryazanov
Issue with your original query was fixed. If you need the fix right now, you can build H2 from its current sources. https://github.com/h2database/h2database Use the jar target as described here: https://h2database.com/html/build.html#building The current sources require JDK 8, 9, 10, 11, or 12.

[h2] Re: exception using IN filter with multiple columns, when data contains null

2020-01-03 Thread Evgenij Ryazanov
Hello. Yes, it looks like a bug. IN predicate may have a row value expressions in its right side, but this case is not currently supported. Older version works only because it incorrectly parses them as arrays. Use can use something like SELECT col1 FROM x WHERE (col1, col2) IN (VALUES ('a1',

[h2] Re: unable to use microsoft sql Libraries with h2 database. it is needed for temp table creation

2019-12-13 Thread Evgenij Ryazanov
H2 has org.h2.tools.SimpleResultSet for such purpose. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To view this

[h2] Re: unable to use microsoft sql Libraries with h2 database. it is needed for temp table creation

2019-12-13 Thread Evgenij Ryazanov
SqlServerDataTable is not a part of H2 and it cannot be used with H2. You can use it only with JDBC driver of MS SQL Server when your database is MS SQL Server. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and

[h2] Re: unable to use microsoft sql Libraries with h2 database. it is needed for temp table creation

2019-12-12 Thread Evgenij Ryazanov
Hello. Please, describe what exactly do you want? If you want to create a linked table to read some data from the SQL Server in H2, you need to add its JDBC driver to the classpath of H2's Java process. Distribution of H2 does not ship with drivers of other databases. -- You received this

[h2] Re: notify client of table changes (replacing polling)

2019-12-02 Thread Evgenij Ryazanov
Hello. No, there is no such feature in H2. Only some databases have different own callbacks and that functionality is not standardized, AFAIK the SQL Standard does not have such features. You can try to write some own code in the trigger to send some messages to your clients using the

[h2] Re: Can't create full text index (H2: v1.4.200 , lucene: v7.7.2 or v8.2.0)

2019-11-26 Thread Evgenij Ryazanov
Unfortunately, you need to recompile H2 with your version of Lucene, or use Lucene 5.5.5. 1.4.200 was source compatible, but binary incompatible with more recent versions. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from

[h2] Re: 1.4.201-pre fails on valid connection string on Windows General error: "java.nio.file.InvalidPathException: Illegal char <:> at index 3

2019-11-25 Thread Evgenij Ryazanov
jdbc:h2:tcp://localhost//C:/Users/… is obliviously invalid, did you try jdbc:h2:tcp://localhost/C:/Users/… with one slash after localhost? -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails

[h2] Re: 1.4.201-pre fails on valid connection string on Windows General error: "java.nio.file.InvalidPathException: Illegal char <:> at index 3

2019-11-22 Thread Evgenij Ryazanov
Your issue should be fixed in the current master branch. Please, fetch the latest sources and re-test it. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[h2] Re: 1.4.201-pre fails on valid connection string on Windows General error: "java.nio.file.InvalidPathException: Illegal char <:> at index 3

2019-11-22 Thread Evgenij Ryazanov
Hello. It looks like a bug. Thanks for the report! -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To view this

[h2] Re: Reproducible Corruption of a database, java.lang.IllegalStateException: Unsupported type 17 [1.4.200/3]

2019-11-22 Thread Evgenij Ryazanov
CAST from one NUMERIC/DECIMAL data type to another one with the same scale is cheap. But if you don't mind that minor difference in precision you can avoid it. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and

[h2] Re: Reproducible Corruption of a database, java.lang.IllegalStateException: Unsupported type 17 [1.4.200/3]

2019-11-21 Thread Evgenij Ryazanov
Not exactly, your assumption doesn't work for operands with different scale. Anyway, the result of addition has larger precision for additional possible digit, so in some use cases an explicit cast is still necessary. -- You received this message because you are subscribed to the Google Groups

[h2] Re: Raspberry PI and H2 1.4.199

2019-11-21 Thread Evgenij Ryazanov
> If this needs to be a security thing, then it should be a command-line argument to control it on a per server basis There is an unsafe command-line argument that allows remote database creation as it was in older versions, do you really read the whole “Creating New Databases” section? Just

[h2] Re: Reproducible Corruption of a database, java.lang.IllegalStateException: Unsupported type 17 [1.4.200/3]

2019-11-20 Thread Evgenij Ryazanov
Hello. 1. Unsupported type 17 is usually thrown when multiple versions of H2 were used with the same database file (versions of TCP clients don't matter, only versions of servers and embedded connections should match). For example, IDEA users are affected, because IDEA uses 1.4.196 it its

[h2] Re: Raspberry PI and H2 1.4.199

2019-11-20 Thread Evgenij Ryazanov
Hello. Security fixes were applied and H2 does not allow remote creation of database by default any more because it actually creates a remote security hole on your server. Unfortunately, a weird error message is generated by the version that you use. 1.4.200 throws an error with better

[h2] Re: Is there a alter grammer to change columns' ORDINAL_POSITION

2019-11-06 Thread Evgenij Ryazanov
Hello. No, there is no such feature in H2 (and in the SQL Standard too). You can add a new column at position that you need, copy data to it with UPDATE, recreate indexes and constraints (if old column was referenced by something), drop old column, and finally rename a new one. -- You

[h2] Re: Strange parsing of common table expression when combined with delta change tables

2019-11-03 Thread Evgenij Ryazanov
The issue with your query was fixed. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To view this discussion on the web

[h2] Re: Strange parsing of common table expression when combined with delta change tables

2019-11-03 Thread Evgenij Ryazanov
Hello. CTEs are experimental in H2 and have known issues, you can find some on GitHub. Support of data change delta tables is a relatively new functionality in H2 and I think nobody tested them in combination with CTE earlier. -- You received this message because you are subscribed to the

Re: [h2] Memory leak ??? org.h2.mvstore.cache.CacheLongKeyLIRS$Entry

2019-11-02 Thread Evgenij Ryazanov
You really need to decrease cache sizes of your databases. You have too many of them for the default setting. And if you want to see the real memory use, you need to compute the retained sizes, but on large dumps they will be computed very slowly. -- You received this message because you are

[h2] Re: Memory leak ??? org.h2.mvstore.cache.CacheLongKeyLIRS$Entry

2019-11-01 Thread Evgenij Ryazanov
Hello. When you open many databases at once you need to decrease the cache size in all of them or at least in the most of them to a some reasonable size for your use case: https://h2database.com/html/commands.html#set_cache_size -- You received this message because you are subscribed to the

[h2] Re: Trailing whitespaces are removed from varchar

2019-10-31 Thread Evgenij Ryazanov
Issue with H2 Console was fixed. https://github.com/h2database/h2database https://h2database.com/html/build.html#building -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an

[h2] Re: Trailing whitespaces are removed from varchar

2019-10-31 Thread Evgenij Ryazanov
This is the same issue. H2 Console reads the formatted value with JavaScript where spaces were already removed by the browser; you can add white-space: pre style to cells (if your browser has development tools) as a workaround. The database is not affected. try (Connection c =

[h2] Re: row_number() over (order by (select null))

2019-10-31 Thread Evgenij Ryazanov
If you want to assign row numbers to a some column, you can use the following command in both SQL Server and H2: CREATE TABLE TEST(ID INT PRIMARY KEY, NUMBER INT); INSERT INTO TEST(ID) VALUES (1), (2), (5), (6), (7), (10); WITH T(ID, RN) AS (SELECT ID, ROW_NUMBER() OVER(ORDER BY (SELECT 1))

[h2] Re: Trailing whitespaces are removed from varchar

2019-10-31 Thread Evgenij Ryazanov
Hello. They aren't removed by H2. Web browser ignores them when it displays a table. Perhaps H2 Console should use some style such as white-space: pre to make them visible. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from

[h2] Re: row_number() over (order by (select null))

2019-10-31 Thread Evgenij Ryazanov
Hello. I tried to execute such command in SQL Server 2012, 2017, and 2019 on db<>fiddle and I must say that it leads to undefined results in this database system. It can set column to 1 in all rows, in can set column to 1 in some rows and to some other number in other rows depending on content

[h2] Re: A negative scale value produces incorrect precision and scale values

2019-10-31 Thread Evgenij Ryazanov
It was already fixed, you can build H2 from its current sources available on GitHub, if you wish. https://github.com/h2database/h2database https://h2database.com/html/build.html#building -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To

<    1   2   3   4   5   6   >