lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

long not accepted as data type #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
(simple SQL scripts or simple standalone applications are preferred)
1. CREATE TABLE IF NOT EXISTS test (
      id LONG,
      PRIMARY KEY(id))

even more simple
2.CREATE TABLE test (id LONG)
3. if 'LONG' is replaced with 'INT' in either of the above cases, the code
executes successfully.

What is the expected output? What do you see instead?
expect successful completion message. Instead, in each example below, it
skips the LONG keyword and looks at the next token as the expected data type.

(from SQL code #1 above):
org.h2.jdbc.JdbcSQLException: Unknown data type: NOT; SQL statement:
CREATE TABLE IF NOT EXISTS test (id LONG NOT NULL, PRIMARY KEY(id)) [50004-113]
        at org.h2.message.Message.getSQLException(Message.java:107)
        at org.h2.message.Message.getSQLException(Message.java:118)
        at org.h2.message.Message.getSQLException(Message.java:77)
        at org.h2.command.Parser.parseColumn(Parser.java:3332)
        at org.h2.command.Parser.parseColumnForTable(Parser.java:3200)
        at org.h2.command.Parser.parseCreateTable(Parser.java:4621)
        at org.h2.command.Parser.parseCreate(Parser.java:3453)
        at org.h2.command.Parser.parsePrepared(Parser.java:321)
        at org.h2.command.Parser.parse(Parser.java:288)
        at org.h2.command.Parser.parse(Parser.java:260)
        at org.h2.command.Parser.prepareCommand(Parser.java:232)
        at org.h2.engine.Session.prepareLocal(Session.java:410)
        at org.h2.engine.Session.prepareCommand(Session.java:371)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1045)
        at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:109)
        at db.Manager.createTables(Manager.java:129)
        at db.Manager.initializeDatabase(Manager.java:52)
        at db.Main.main(Main.java:17)

(from SQL code #2 above):
org.h2.jdbc.JdbcSQLException: Unknown data type: ); SQL statement:
CREATE TABLE test (id LONG) [50004-113]
        at org.h2.message.Message.getSQLException(Message.java:107)
        at org.h2.message.Message.getSQLException(Message.java:118)
        at org.h2.message.Message.getSQLException(Message.java:77)
        at org.h2.command.Parser.parseColumn(Parser.java:3332)
        at org.h2.command.Parser.parseColumnForTable(Parser.java:3200)
        at org.h2.command.Parser.parseCreateTable(Parser.java:4621)
        at org.h2.command.Parser.parseCreate(Parser.java:3453)
        at org.h2.command.Parser.parsePrepared(Parser.java:321)
        at org.h2.command.Parser.parse(Parser.java:288)
        at org.h2.command.Parser.parse(Parser.java:260)
        at org.h2.command.Parser.prepareCommand(Parser.java:232)
        at org.h2.engine.Session.prepareLocal(Session.java:410)
        at org.h2.engine.Session.prepareCommand(Session.java:371)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1045)
        at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:109)
        at db.Manager.createTables(Manager.java:128)
        at db.Manager.initializeDatabase(Manager.java:52)
        at db.Main.main(Main.java:17)

What version of the product are you using? On what operating system, file
system, and virtual machine?
h2-1.1.113.jar from the h2-2009-05-21.zip archive
Ubuntu 8.10, 64-bit version, Kernel Linux 2.6.27-14-generic, GNOME 2.24.1,
Netbeans 6.1 and JDK 1.6

Do you know a workaround? use 64-bit VARCHAR, convert to/from long

How important/urgent is the problem for you?
important

In your view, is this a defect or a feature request? defect

Please provide any additional information below.

Original issue reported on code.google.com by gary.may...@gtempaccount.com on 29 May 2009 at 8:17

GoogleCodeExporter commented 9 years ago
Sorry, when I put my example code in I missed some words. Example #1, 2nd line, 
should read 'id LONG NOT NULL,', which should make more sense when viewed in 
context 
of the error generated.

Original comment by gary.may...@gtempaccount.com on 29 May 2009 at 5:20

GoogleCodeExporter commented 9 years ago
Hi,

I'm not sure if you saw the list of supported data types at
http://www.h2database.com/html/datatypes.html

Why do you need support for LONG, and what should it be mapped to (to a
java.lang.Long?) Is this a compatibility problem with another database, if yes 
which
one supports LONG? Could you add a link to the documentation of this database?

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 2 Jun 2009 at 6:37

GoogleCodeExporter commented 9 years ago
Thomas,

Thank you for the response. The trouble seems to be some discrepancy with the
documentation.

I was using the h2.pdf file for reference that was included in the H2 archive,
h2-2009-05-21.zip, in the /h2/docs/ directory. This is the same archive from 
where I
drew the h2 jar file in the /h2/bin directory. I have attached the pdf document 
to
this message. Please see the bottom of page 100 of 145, which (by my 
understanding)
specifies a Long data type.

The link you provided, http://www.h2database.com/html/datatypes.html, obviously 
talks
about BIGINT and doesn't include LONG. When I use BIGINT in the places that I 
desired
a LONG, everything executes well. So, I will continue to use this reference 
from here
on out.

Thanks again and regards,

- Gary

Original comment by gary.may...@gtempaccount.com on 3 Jun 2009 at 12:29

Attachments:

GoogleCodeExporter commented 9 years ago
After re-reviewing the pdf and the link, which now appear to be the same, I see 
that
I was misreading the document. 'Long' is under the System Tables section. I am
assuming it is meant as the specification of a type of value that may be 
inserted,
updated, etc. The data types are further down in the document.

I apologize for the error. Please close this issue.

Regards,

- Gary

Original comment by gary.may...@gtempaccount.com on 3 Jun 2009 at 1:32

GoogleCodeExporter commented 9 years ago
Hi,

I will try to support LONG as an alias for BIGINT in the next release. I'm not 
sure
if it is possible, there might be a conflict with compatibility (for example 
Oracle
supports LONG RAW which is a byte array).

Original comment by thomas.t...@gmail.com on 6 Jun 2009 at 9:59

GoogleCodeExporter commented 9 years ago

Original comment by thomas.t...@gmail.com on 13 Jun 2009 at 7:59

GoogleCodeExporter commented 9 years ago
Implemented in the latest release (1.1.115)

Original comment by thomas.t...@gmail.com on 27 Jun 2009 at 9:38