Re: [h2] H2 SELECT AS with GROUP BY

2014-01-22 Thread vrotaru...@gmail.com
should it not be GROUP BY id ??? On Wed, Jan 22, 2014 at 3:31 PM, Mindaugas Slusnys < slusnys.mindau...@gmail.com> wrote: > CREATE TABLE "test" ( > > id int, > > value int > > ); > > INSERT INTO "test" VALUES (1, 10); > > INSERT INTO "test" VALUES (2, 20); > > INSERT INTO "test" VALUES (3, 30);

Re: [h2] Support for the POINT datatype such as Postgres and Mysql have

2013-09-27 Thread vrotaru...@gmail.com
This seem to wok... create table points (id identity, point point not null) insert into points(point) values((2, 3)) On Fri, Sep 27, 2013 at 3:49 PM, Paul Taylor wrote: > > > On Friday, 27 September 2013 12:38:38 UTC+1, Vasile Rotaru wrote: >> >> create domain point as array check (array_leng

Re: [h2] Support for the POINT datatype such as Postgres and Mysql have

2013-09-27 Thread vrotaru...@gmail.com
create domain point as array check (array_length(value) = 2) this? On Fri, Sep 27, 2013 at 1:47 PM, Paul Taylor wrote: > Thats promising, but im trying to create a table with a POINT datatype, is > that possible in my sql this line is failng: > > coordinates POINT, > > so is there

Re: [h2] Computed column and _ROWID_: not updated when I think it should be

2013-08-29 Thread vrotaru...@gmail.com
It was a guess. And after a few greps over the source code, I'm not a lot wiser. If someone is curious enough to run an insert under debugger the methods which should watched seem to be Table#validateConvertUpdateSequence & Column#validateConvertUpdateSequence Regards On Thu, Aug 29, 2013 at 7:

Re: [h2] Computed column and _ROWID_: not updated when I think it should be

2013-08-29 Thread vrotaru...@gmail.com
My understanding is that the value of a computed column is set before the actual insertion. This will explain the observed behavior. On Aug 29, 2013 6:30 PM, "Laird Nelson" wrote: > I have a column defined like this: > > rowid int as convert(_rowid_, int) > > The idea is that I am trying to ef

Re: Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
On Tue, Oct 23, 2012 at 3:10 AM, wrote: > merge into File (filepath, filesize, datemodified) key (filepath) values > (?,?,?) I've just created a table and tried this from the H2 console merge into File (filepath, filesize, datemodified) key (filepath) values ('foo',,889) No exception. And

Re: Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
n't yet > been able to get that to work. > > > Unless there's a bug in H2, the exception is an indication that the merge command is trying to modify more than one row. Anyway, I'm afraid I cannot help you with further advice. > On , "vrotaru...@gmail.com"

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
>From the merge documention "MERGE INTO [ ..] Updates existing rows, and insert rows that don't exist. If no key column is specified, the primary key columns are used to find the row. If more than one row per new row is affected, an exception is thrown. If the table contains an auto-incremented ke

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
On Tue, Oct 23, 2012 at 12:15 AM, Rami Ojares wrote: > What is the difference between varchar and text. H2 specifically rejects >> using unique or primarykey for text fields. >> > > I am looking at the list of types supported by h2 > http://www.h2database.com/**html/datatypes.html

Re: Insert if row does not already exist, cache PreparedStatement in a function

2012-10-22 Thread vrotaru...@gmail.com
So what's wroing with: create table unique_names (id identity, name varchar not null unique) You can even make the a column of type varchar the primary key. I did. On Mon, Oct 22, 2012 at 7:18 PM, Brent Ellwein wrote: Hello, > > I am trying to have a unique String column for my H2 databa

Re: Using OR in where clause does not use index

2012-10-03 Thread vrotaru...@gmail.com
This was already discussed some time ago. A working workaround is to use (SELECT ..) UNION (SELECT ...) instead of OR. On Tue, Oct 2, 2012 at 6:57 PM, BrianR wrote: If column a is index and running a query of > > SELECT * FROM tableFoo WHERE a = 'value' OR a LIKE 'value2' > > does not use

Re: starting mixed mode via jdbc url

2012-07-12 Thread vrotaru...@gmail.com
SERVER_AUTO or SERVER=AUTO You add that option to jdbc url and the first client connecting starts the server. Obviously h2.jar should be in class path for all clients On Fri, Jul 13, 2012 at 6:48 AM, Mike Power wrote: > Is it possible to automatically start a tcp server when connecting to a > jd

Re: Execute SQL on database creation

2012-05-08 Thread vrotaru...@gmail.com
Spring does not detect anything, and the spring is run always. CREATE TABLE $TableName IF NOT EXISTS ... and MERGE ... are your firends ;) On Tue, May 8, 2012 at 11:20 PM, Luigi R. Viggiano < luigi.viggi...@newinstance.it> wrote: > > If you are using Spring, you can init H2 using the jdbc:emb

Re: Execute SQL on database creation

2012-05-08 Thread vrotaru...@gmail.com
If you are using Spring, you can init H2 using the jdbc:embedded-database element and then use jdbc:script property More here: http://stackoverflow.com/questions/7968067/startup-script-to-create-a-schema-in-hsqldb On Tue, May 8, 2012 at 10:50 PM, Luigi R. Viggiano wrote: > Hello everybody. > >

Re: How to calculate md5sum in a computed column?

2012-04-20 Thread vrotaru...@gmail.com
On Fri, Apr 20, 2012 at 4:56 PM, Christian MICHON < christian.mic...@gmail.com> wrote: > Hi Steve, > > yes, after x millions of records, it would be nice to have the checksum > taking minimal space. > > H2 has a BINARY SQL type mapped to byte[]. Most probably, you can't go lower than that --

Re: WHERE clause handling of null: "IS NULL" versus "=?" & setNull

2012-03-12 Thread vrotaru...@gmail.com
On Mon, Mar 12, 2012 at 7:17 PM, Mark Addleman wrote: > Gotcha. Thanks for the explanation. Looks like I need to bone up on my > Chris Date :) > > One more question: Given the spec, what value is the setNull method in > PreparedStatement? > Never used that one. For queries at least. I did for

Re: WHERE clause handling of null: "IS NULL" versus "=?" & setNull

2012-03-12 Thread vrotaru...@gmail.com
On Mon, Mar 12, 2012 at 6:41 PM, Mark Addleman wrote: > Attached is a test case that demonstrates a difference in how where clause > handles NULL. In the first case, my SELECT includes "WHERE c IS NULL" My > second case has "WHERE c=?" and then I do preparedStatement.setNull(1, > Types.VARCHAR).

Re: ALTER TABLE: change precision for VARCHAR column

2012-01-24 Thread vrotaru...@gmail.com
Will the following work? alter table YOUR_TABLE add COPY_OF_REAL_COLUMN varchar default REAL_COLUMN; alter table YOUR_TABLE drop column REAL_COLUMN; alter table YOUR_TABLE alter column COPY_OF_REAL_COLUMN to REAL_COLUMN; Or a variation with update? -- Vasile Rotaru -- You received this mes

Re: regarding data partition in h2db

2012-01-04 Thread vrotaru...@gmail.com
There was a suggestion some time ago about using a RAM disk as db storage as an alternative to in-memory database. An advantage will be that you should not worry about GC, but it will still be slower that a plain in-memory db. Maybe, the nio stuff in H2 can alleviate that. Otherwise.. the problem

Re: Tamper detection

2011-12-21 Thread vrotaru...@gmail.com
On Tue, Dec 20, 2011 at 10:17 PM, Thomas Mueller < thomas.tom.muel...@gmail.com> wrote: > Hi, > > > why is adding a content_hash column to the relevant tables not an option? > > That wouldn't prevent you from deleting rows, and re-adding previously > deleted rows. > Yes. While one can prevent re-

Re: Tamper detection

2011-12-16 Thread vrotaru...@gmail.com
Maybe I'm missing something but.. why is adding a content_hash column to the relevant tables not an option? Yes, you'll have to to compute the hash and check it on the client side. -- Vasile Rotaru -- You received this message because you are subscribed to the Google Groups "H2 Database"

Re: Prealloc database file at specific size

2011-12-13 Thread vrotaru...@gmail.com
On Tue, Dec 13, 2011 at 6:18 PM, Marco Biancini wrote: > In order to be more protected against a file system full condition, is > it possible to pre-alloc the db file at specific size ? > > My guess that this is impossible, if H2 is using the standard file API. A workaround would be to create a di

Re: [patch] Improving the shell script

2011-12-12 Thread vrotaru...@gmail.com
Oops... dr-racket.org is actually racket-lang.org On Tue, Dec 13, 2011 at 8:37 AM, vrotaru...@gmail.com wrote: > > > On Mon, Dec 12, 2011 at 8:07 PM, Thomas Mueller < > thomas.tom.muel...@gmail.com> wrote: > >> Hi, >> >> Thanks, but that's far to

Re: [patch] Improving the shell script

2011-12-12 Thread vrotaru...@gmail.com
On Mon, Dec 12, 2011 at 8:07 PM, Thomas Mueller < thomas.tom.muel...@gmail.com> wrote: > Hi, > > Thanks, but that's far too complex for me. I would rather not support this > feature than to make the shell script so complicated. Sorry. Of course you > can still use it if you need to. > > Hi, I und

Re: [patch] Improving the shell script

2011-12-01 Thread vrotaru...@gmail.com
Re: startup script. Some time ago I wrote this script below using for the first part the standard prologue of plt scripts. The advantage being that you can launch using a symbolic link to a symbolic link to a... So if you are going to modify it you make consider this version as well: #!/bin/sh #

Re: Problems with constraint referencing defining table.

2011-09-06 Thread vrotaru...@gmail.com
On Tue, Sep 6, 2011 at 10:47 PM, Rami Ojares wrote: > ** > > create table basket_impossible ( > customer varchar (48) not null > references customer(name), > ord integer as > (select count(*) from basket_impossible as self > where basket_impossible.customer = s

Re: Problems with constraint referencing defining table.

2011-09-06 Thread vrotaru...@gmail.com
Hi, On Tue, Sep 6, 2011 at 9:17 PM, Thomas Mueller wrote: > Hi, > > I will document it: > > "Check constraints can only reference objects that exist while the > statement is executed." > I understand. I did a bit of parsing (including a carefully chosen subset of SQL) and I've read the Parser.

Re: Cannot name PRIMARY KEY constraints of IDENTITY fields

2011-09-04 Thread vrotaru...@gmail.com
Hi On Sun, Sep 4, 2011 at 9:49 PM, Caleb wrote: > I'm trying to give names to all the constraints I create, but for some > reason, I can't change the name of the constraint for IDENTITY typed > columns, example: > DROP TABLE IF EXISTS SUPPLIERS; > CREATE TABLE SUPPLIERS ( > SUPPL_IDBIGINT I

Problems with constraint referencing defining table.

2011-09-04 Thread vrotaru...@gmail.com
Hi, If anything, I blame Joe and his books. Anyway, here's the problem this works: create table accounting_period ( merchant varchar(48) not null references merchant(name), period varchar(8) not null check (period in ('DAY', 'MONTH')), n integer not null check

Re: invalid sql?

2011-08-25 Thread vrotaru...@gmail.com
Hi On Thu, Aug 25, 2011 at 11:19 AM, Nitin wrote: > being curious, executed few more and they worked too ! > > select x from dual insert > select x from dual create > select x from dual index > select x from dual loop > select x from dual for > select x from dual while > > What your have here i