D
D
Dmitry Andriyanov2011-09-09 09:59:01
firebird
Dmitry Andriyanov, 2011-09-09 09:59:01

Why doesn't Firebird throw an exception?

Good afternoon!
I execute the following sequence of requests to Firebird, everything is fine, although, IMHO, an error should be generated.

ALTER TABLE &quot;TestTable&quot; ADD &quot;TestStringColumn&quot; VARCHAR(7) CHARACTER SET UNICODE_FSS<br/>
<br/>
INSERT INTO &quot;TestTable&quot; (&quot;ID&quot;,&quot;TestStringColumn&quot;) VALUES ('6','1234567890')<br/>

Those. create a string field of 7 characters and insert text of 10 characters into it. The rest of the DBMS, on which I tried to do similar actions (MSSQL, Oracle, MySQL, PostgreSQL), give an error.
Maybe someone knows what is the reason?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Gluttton, 2011-09-09
@dima117

1. Try to enter 22 digits;
2. Try to enter 21 digits;
3. Try to enter Habrahabr;
4. Try to enter Habrakh;
5. Read this: www.ibase.ru/devinfo/ib_unicode.htm .
Thanks for the good question, I didn't know that before :)!

A
alexmuz, 2011-09-09
@alexmuz

MySQL doesn't always throw an error either.
Example:
CREATE TABLE `test` (
`id` INT NOT NULL,
`name` VARCHAR( 7 ) NOT NULL,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM;
Query:
INSERT INTO test (id, name) VALUES ('6','1234567890');
There is such a parameter as sql_mode, which is responsible for compatibility.
If it is set to STRICT_TRANS_TABLES, then you will get an error:
#1406 - Data too long for column 'name' at row 1
And if it is empty or ANSI, then the query will be successfully completed and the data will simply be silently truncated.
I suspect that there is a similar parameter in Firebird.

M
Monca, 2011-09-09
@Monca

How do you know there is no error? Maybe your driver is broken. Server version not specified.
And the best place for such questions is sql.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question