Re: [h2] Year alias in select statement

2024-02-17 Thread 'Peter Borissow' via H2 Database
Thanks for checking Evgenij. I was mistaken - adding "YEAR" to the "NON_KEYWORDS" does indeed work. There was a different issue on my end that was throwing things off. Appreciate everyone's help. Best,Peter On Saturday, February 17, 2024 at 02:19:07 AM EST, Evgenij Ryazanov wrote: He

Re: [h2] Year alias in select statement

2024-02-16 Thread Evgenij Ryazanov
Hello! YEAR is a reserved word even in archaic SQL-92, so it was a bad idea to use it as unquoted identifier. BTW, DATE and TRANSACTION are reserved words too, but H2 allows their usage as identifiers. Also there is no YEAR function in the Standard, correct syntax is EXTRACT(YEAR FROM someValue

Re: [h2] Year alias in select statement

2024-02-16 Thread Andreas Reichel
Please discuss with the H2 developers first. My understanding is: the current trend goes to SQL:2016 compliance and the Compatibility modes are more or less seen as a tolerated legacy. So any extension of those modes may not be welcome unconditionally, when it introduced complexity or maintenance i

Re: [h2] Year alias in select statement

2024-02-16 Thread 'Peter Borissow' via H2 Database
Thank you. I get it. Compatibility mode with PostgreSQL is incomplete and certain regressions are to be expected when jumping major versions. I would be willing to help patch the sw. Whether I would succeed is another matter :-) I'll pull the source and start a new thread as needed. Many thanks

Re: [h2] Year alias in select statement

2024-02-16 Thread Andreas Reichel
On Sat, 2024-02-17 at 08:09 +0700, Andreas Reichel wrote: > Quoting transaction didn't have any effect. Try again on MS SQL Server 😄 -- 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 i

Re: [h2] Year alias in select statement

2024-02-16 Thread Andreas Reichel
Greetings! On Sat, 2024-02-17 at 00:47 +, 'Peter Borissow' via H2 Database wrote: > > Hi Andreas, >    Thanks for the quick reply! As you suggest, quoting "year" as the > alias works. Quoting transaction didn't have any effect. Several > questions: > > (1) What doesn't this work? > properties.

Re: [h2] Year alias in select statement

2024-02-16 Thread 'Peter Borissow' via H2 Database
Hi Andreas,   Thanks for the quick reply! As you suggest, quoting "year" as the alias works. Quoting transaction didn't have any effect. Several questions: (1) What doesn't this work? properties.setProperty("NON_KEYWORDS", "YEAR"); (2) I am in PostgreSQL mode. On a PostgreSQL server, I don't have

Re: [h2] Year alias in select statement

2024-02-16 Thread Andreas Reichel
Good Morning. `YEAR` is a SQL:2016 reserved keyword:  http://www.h2database.com/html/advanced.html?highlight=keyword&search=keyword#keywords You will need to quote your alias: SELECT Year( date ) AS "YEAR" FROM "transaction" ; Similar thing for `TRANSACTION`. It is always advisable to avoid such

[h2] Year alias in select statement

2024-02-16 Thread 'Peter Borissow' via H2 Database
Dear H2 Community,    I ran into an unexpected error today migrating from 1.x to 2.x. I'm using H2 2.2.224 in PostgreSQL mode using the following parameters properties.setProperty("MODE", "PostgreSQL"); properties.setProperty("DATABASE_TO_LOWER", "TRUE"); properties.setProperty("DEFAULT_NULL_ORDER