Subject Re: RC2 Jaybird JDBC bug on view select
Author mountaintrailblazing <mountaintrailblazi
Hi Roman,

Thanks for the reply... well, in regards to the spreadsheet view
problem, this is the view I used:


CREATE VIEW "SPREADSHEET_VIEW_TEST" (
"SEASON_NO", "CONFIGURATION_SOURCE_NO", "NULLINT", "SMALLINT_1
", "SMALLINT_2",
"INTEGER_1", "INTEGER_2", "FLOAT_1", "FLOAT_2", "DOUBLE_PREC
ISION_1",
"DOUBLE_PRECISION_2", "DATE_1", "DATE_2", "TIME_1", "TIME_2"
, "TIMESTAMP_1",
"TIMESTAMP_2", "DECIMAL_1", "DECIMAL_2", "NUMERIC_1", "NUMER
IC_2", "CHAR_1",
"CHAR_2", "CRAZY_STRING", "BLOB1", "BLOB2"
) AS
SELECT
SEASON_NO, CONFIGURATION_SOURCE_NO, NULLINT, SMALLINT_1,
SMALLINT_2, INTEGER_1,
INTEGER_2, FLOAT_1, FLOAT_2, DOUBLE_PRECISION_1,
DOUBLE_PRECISION_2, DATE_1,
DATE_2, TIME_1, TIME_2, TIMESTAMP_1, TIMESTAMP_2, DECIMAL_1,
DECIMAL_2,
NUMERIC_1, NUMERIC_2, CHAR_1, '', (VARCHAR_1 || ' ' ||
VARCHAR_2) AS CRAZY_STRING,
BLOB_1, BLOB_2
FROM SPREADSHEET_TEST;

The '' portion (defined as char_2 in the view) was causing all the
trouble..

This is the table the view is based on:

CREATE TABLE "SPREADSHEET_TEST"
(
"SEASON_NO" INTEGER, "CONFIGURATION_SOURCE_NO" INTEGER, "NULLINT"
INTEGER,
"SMALLINT_1" SMALLINT, "SMALLINT_2" SMALLINT, "INTEGER_1" INTEGER,
"INTEGER_2" INTEGER, "FLOAT_1" FLOAT, "FLOAT_2" FLOAT,
"DOUBLE_PRECISION_1" DOUBLE PRECISION, "DOUBLE_PRECISION_2" DOUBLE
PRECISION,
"DATE_1" DATE, "DATE_2" DATE, "TIME_1" TIME, "TIME_2" TIME,
"TIMESTAMP_1" TIMESTAMP, "TIMESTAMP_2" TIMESTAMP, "DECIMAL_1"
DECIMAL(6, 2),
"DECIMAL_2" DECIMAL(12, 4), "NUMERIC_1" NUMERIC(6, 2),
"NUMERIC_2" NUMERIC(12, 4), "CHAR_1" CHAR(20), "CHAR_2" CHAR(20),
"VARCHAR_1" VARCHAR(40), "VARCHAR_2" VARCHAR(60),
"BLOB_1" BLOB SUB_TYPE 0 SEGMENT SIZE 80,
"BLOB_2" BLOB SUB_TYPE TEXT SEGMENT SIZE 160
);

I populated the table spreadsheet_test with the following two inserts:

INSERT INTO "SPREADSHEET_TEST"
("SEASON_NO", "CONFIGURATION_SOURCE_NO", "NULLINT", "SMALLINT_1", "SMA
LLINT_2", "INTEGER_1", "INTEGER_2", "FLOAT_1", "FLOAT_2", "DOUBLE_PREC
ISION_1", "DOUBLE_PRECISION_2", "DATE_1", "DATE_2", "TIME_1", "TIME_2"
, "TIMESTAMP_1", "TIMESTAMP_2", "DECIMAL_1", "DECIMAL_2", "NUMERIC_1",
"NUMERIC_2", "CHAR_1", "CHAR_2", "VARCHAR_1", "VARCHAR_2" ) VALUES
(5, 1001, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL );

INSERT INTO "SPREADSHEET_TEST"
("SEASON_NO", "CONFIGURATION_SOURCE_NO", "NULLINT", "SMALLINT_1", "SMA
LLINT_2", "INTEGER_1", "INTEGER_2", "FLOAT_1", "FLOAT_2", "DOUBLE_PREC
ISION_1", "DOUBLE_PRECISION_2", "DATE_1", "DATE_2", "TIME_1", "TIME_2"
, "TIMESTAMP_1", "TIMESTAMP_2", "DECIMAL_1", "DECIMAL_2", "NUMERIC_1",
"NUMERIC_2", "CHAR_1", "CHAR_2", "VARCHAR_1", "VARCHAR_2", "BLOB_1",
"BLOB_2") VALUES (5, 1001, NULL, 1, 1, 1, 1, 1, 1, 1,
1, '2002/01/01', '2003/01/01', '1:00:00', '8:00:00', '2002/01/01
1:00:00', '2003/01/01 8:00:00', 1.01, 1.0001, 1.01, 1.001, 'char_1
#1', '', 'varchar_1 #1', 'varchar_2 #1', 'blob_1 #1', 'blob_2 #1');

And then I executed this insert two hundred times to populate it with
another 200 rows of data.

INSERT INTO SPREADSHEET_TEST
("SEASON_NO", "CONFIGURATION_SOURCE_NO", "SMALLINT_1", "SMALLINT_2", "
INTEGER_1", "INTEGER_2", "FLOAT_1", "FLOAT_2", "DOUBLE_PRECISION_1", "
DOUBLE_PRECISION_2", "DATE_1", "DATE_2", "TIME_1", "TIME_2", "TIMESTAM
P_1", "TIMESTAMP_2", "DECIMAL_1", "DECIMAL_2", "NUMERIC_1", "NUMERIC_2
", "CHAR_1", "CHAR_2", "VARCHAR_1", "VARCHAR_2", "BLOB_1", "BLOB_2")
select 5, 1001, max(SMALLINT_1)+1, max(SMALLINT_2)+1, max(INTEGER_1)
+1, max(INTEGER_2)+1, max(float_1)+1, max(float_2)+1, max
(double_precision_1)+1, max(double_precision_2)+1, max(date_1) + 1,
max(date_2)+1, max (time_1)+1, max(time_2)+1, max(timestamp_1)+1, max
(timestamp_2)+1, max(decimal_1)+1.01, max(decimal_2)+1.0001, max
(numeric_1)+1.01, max(numeric_2)+1.0001, ('char_1 #' || (max
(integer_1)+1)), '', ('varchar_1 #' || (max(integer_1)+1)),
('varchar_2 #' || (max(integer_1)+1)), ('blob_1 #' || (max(integer_1)
+1)), ('blob_2 #' || (max(integer_1)+1)) FROM SPREADSHEET_TEST;


Tom

--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy
<rrokytskyy@y...>" <rrokytskyy@y...> wrote:
> Hi,
>
> > In version RC2 of Jaybird (released Dec. 2002), there is a small
> > JDBC bug when reading from a view. If that view contains a ''
> > mapping, various errors occur upon select, most commonly "out of
> > memory."
> >
> > For example, a view defined as:
> >
> > CREATE VIEW "TEST" ("SEASON_NO", "EMPTY_CHAR")
> > AS
> > SELECT SEASON_NO, '' FROM SPREADSHEET_TEST;
> >
> > Will cause the aforementioned problems. As soon as the '' is
> > removed, it works fine.
>
> Can you post a small test case to reproduce the bug? I tried
current
> CVS version and found other problems when using a this type of view
> (request sync. error in autocommit mode, fetch bug with explicit tx
> management), but no OutOfMemoryException.
>
> Note, this view definition is not 100% correct because you do not
> give a hint to a server what is the size of your EMPTY_CHAR column.
> Using CAST('' AS VARCHAR(1)) solves the problem. But I will try to
> fix present bugs too.
>
> Thanks!
> Roman Rokytskyy