Re: why too long entries get _cut_ without error

2002-01-17 Thread M. A. Alves

On Thu, 17 Jan 2002, Henning Sprang wrote:
 ... I just realized that Mysql simply cuts  Data i want to insert
 into a field when it is too long, without giving any warning or error
 message. . .

If the field has fixed length that is standard behaviour (together with
right-padding too short values with spaces).

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823 fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugalmob 351+939354002



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread Henning Sprang

M. A. Alves wrote:

 On Thu, 17 Jan 2002, Henning Sprang wrote:
 
... I just realized that Mysql simply cuts  Data i want to insert
into a field when it is too long, without giving any warning or error
message. . .

 
 If the field has fixed length that is standard behaviour (together with
 right-padding too short values with spaces).
 
 

Yes,
I know, this is standart, dosumented behaviour, but i just cannot 
imagine _why_ and asked therfore...

henning


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread M. A. Alves

On Thu, 17 Jan 2002, Henning Sprang wrote:
 ... I just realized that Mysql simply cuts  Data i want to insert
 into a field when it is too long, without giving any warning or error
 message. . .
  If the field has fixed length that is standard behaviour (together with
  right-padding too short values with spaces).
 Yes, I know, this is standart, dosumented behaviour, but i just cannot
 imagine _why_ and asked therfore...

So your field is of fixed length type (you hadn't told us that yet).

As to the rationale, I don't think SQL has one. I would guess it was
simplicity (of the definition of SQL), not withstanding the fact that SQL
is spuriously complicated in other things.

Cheers,

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823 fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugalmob 351+939354002



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread Henning Sprang

M. A. Alves wrote:

  On Thu, 17 Jan 2002, Henning Sprang wrote:
  So your field is of fixed length type (you hadn't told us that yet).


Aehm, no, it isn't! It's VARCHAR.

Sorry I overread that part, a colleague sitting next to me told me that
this behaviour is _normal_ and documented, and so I didn't read the
manual then myself, was just curious what the reasons are.

Is it an undocumented feature then when this happens with VARCHAR fields?


TIA,
henning


BTW:
this message just came back top me with the order to put
database,sql,query,table into it because it would be considered spam 
else. how about letting messages through with field, too,
and how about checking if it's a reply to a thread?




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread M. A. Alves

On Thu, 17 Jan 2002, Henning Sprang wrote:
  So your field is of fixed length type (you hadn't told us that yet).
 Aehm, no, it isn't! It's VARCHAR.

Doesn't matter: If you assign a value to a CHAR or VARCHAR column that
exceeds the column's maximum length, the value is truncated to fit.
(MySQL Manual)

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823 fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugalmob 351+939354002



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread Ryan Fox

  Doesn't matter: If you assign a value to a CHAR or VARCHAR column that
  exceeds the column's maximum length, the value is truncated to fit.

 ok, so it isn't depending on fixed length as you first said, and the
 reason for it is just the simple design of sql, right?

As I see it, the question is what should an SQL server do in this case of a
value being assigned to a CHAR (or VARCHAR) column that exceeds the column's
maximum length.

The current action is that this value is truncated to fit the column.  The
other option would be to automagically expand the column's length so the
value would fit.  Despite what the original poster may think, they _really_
don't want that to happen.  Apart from applications that depend on only
receiving a certain length string from a query (think buffer overflow),
having an insert unexpected alter an indexed char column on a 200,000 row
table would be A Bad Thing.

I wouldn't be terribly opposed to having an option to be set to allow this,
but it shouldn't be on by default, and most MySQL users who can read the
manual and find the option to do this should already know why this is a bad
thing and not want to use it.

Ryan


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: why too long entries get _cut_ without error

2002-01-17 Thread Carsten H. Pedersen

   Doesn't matter: If you assign a value to a CHAR or VARCHAR 
 column that
   exceeds the column's maximum length, the value is truncated to fit.
 
  ok, so it isn't depending on fixed length as you first said, and the
  reason for it is just the simple design of sql, right?
 
 As I see it, the question is what should an SQL server do in this 
 case of a
 value being assigned to a CHAR (or VARCHAR) column that exceeds 
 the column's
 maximum length.

It should, of course, follow the SQL standard, which explicitly
states that the value should be truncated and a warning issued.

MySQL does both.

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread M. A. Alves

On Thu, 17 Jan 2002, Henning Sprang wrote:
 ok, so it isn't depending on fixed length as you first said, and the
 reason for it is just the simple design of sql, right?

Right. (Sorry for the previous inacuracy, I was using 'fixed' in a wide
sense viz. including 'bounded'.)

Cheers,

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823 fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugalmob 351+939354002



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: why too long entries get _cut_ without error

2002-01-17 Thread M. A. Alves

On Thu, 17 Jan 2002, Ryan Fox wrote:
 The current action is that this value is truncated to fit the column.  The
 other option would be to automagically expand the column's length so the
 value would fit.  Despite what the original poster may think, they _really_
 don't want that to happen.

Right. That is what the 'text' type is there for.

 I wouldn't be terribly opposed to having an option to be set to allow this,

No need. Just let the 'text' type get into the SQL standard, if it is not
already there.

Cheers,

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823 fax 351+226003654
 A L V E S   P-4150-180 PORTO, Portugalmob 351+939354002



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php