Subject | Re: [firebird-support] String right truncation Error |
---|---|
Author | Aldo Caruso |
Post date | 2012-02-25T15:26:08Z |
I did the three tests you mention and the error persists in Firebird 2.5
( and it does not exists neither in 2.0 version nor in 2.1 version )
More, I recreated the error with brand new tables and view, so anybody
can recreate it and verify.
CREATE TABLE TABLE_1 (
ID INTEGER NOT NULL
);
ALTER TABLE TABLE_1 ADD CONSTRAINT PK_TABLE_1 PRIMARY KEY (ID);
CREATE TABLE TABLE_2 (
ID INTEGER NOT NULL,
MOTOR INTEGER NOT NULL
);
ALTER TABLE TABLE_2 ADD CONSTRAINT PK_TABLE_2 PRIMARY KEY (ID, MOTOR);
CREATE VIEW VIEW_1(
ID)
AS
select id from table_1
where id not in (select id from table_2 where motor = 0)
;
Fill TABLE_1 with numbers from 1 to 10 so that
select * from table_1;
ID
============
1
2
3
4
5
6
7
8
9
10
Fill TABLE_2 so that
select * from table_2;
ID MOTOR
============ ============
1 0
2 0
3 0
4 0
5 0
6 0
8 0
9 0
10 0
1 1
2 1
3 1
Then select from the view
select * from view_1;
ID
============
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
-unknown ISC error 335544914
On the other hand, if you empty both tables and select from the view,
the result is empty and no error is displayed.
Aldo Caruso
El 25/02/12 06:10, Mark Rotteveel escribió:
( and it does not exists neither in 2.0 version nor in 2.1 version )
More, I recreated the error with brand new tables and view, so anybody
can recreate it and verify.
CREATE TABLE TABLE_1 (
ID INTEGER NOT NULL
);
ALTER TABLE TABLE_1 ADD CONSTRAINT PK_TABLE_1 PRIMARY KEY (ID);
CREATE TABLE TABLE_2 (
ID INTEGER NOT NULL,
MOTOR INTEGER NOT NULL
);
ALTER TABLE TABLE_2 ADD CONSTRAINT PK_TABLE_2 PRIMARY KEY (ID, MOTOR);
CREATE VIEW VIEW_1(
ID)
AS
select id from table_1
where id not in (select id from table_2 where motor = 0)
;
Fill TABLE_1 with numbers from 1 to 10 so that
select * from table_1;
ID
============
1
2
3
4
5
6
7
8
9
10
Fill TABLE_2 so that
select * from table_2;
ID MOTOR
============ ============
1 0
2 0
3 0
4 0
5 0
6 0
8 0
9 0
10 0
1 1
2 1
3 1
Then select from the view
select * from view_1;
ID
============
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
-unknown ISC error 335544914
On the other hand, if you empty both tables and select from the view,
the result is empty and no error is displayed.
Aldo Caruso
El 25/02/12 06:10, Mark Rotteveel escribió:
>[Non-text portions of this message have been removed]
> On 24-2-2012 20:16, Aldo Caruso wrote:
> > I migrated from Firebird 2.0 to 2.5
> > The databas has a VIEW wich basically selects two fields: CODIGO (
> > Integer ) and NOMBRE (Varchar 50 ) from a table.
> > When in Firebird 2.0 there was no problem running SELECT * FROM
> > <VIEW_NAME>
> > Now, in Firebird 2.5 I got the following error message:
> >
> > SQL> select * from<VIEW NAME>l;
> >
> > CODIGO NOMBRE
> > ======= ==============================
> > Statement failed, SQLSTATE = 22001
> > arithmetic exception, numeric overflow, or string truncation
> > -string right truncation
> >
> >
> > I suspect this has something to do with character sets. In the
> > underlying table, the field NOMBRE is VARCHAR(50) ISO8859_1
> > Thanks in advance for any help.
>
> Not sure what would cause this, but what happens if you do:
> * Select only CODIGO from the view
> * Select only NOMBRE from the view
> * Drop and recreate the view
>
> Have you checked the view definition if it might contain smaller column
> than the source table?
>
> Mark
> --
> Mark Rotteveel
>
>