Let us create a table:

  create table foo (
    bar text
  );

Let's look at it in information_schema:

  SELECT column_name
    , data_type
    , character_maximum_length
  FROM information_schema.columns
  WHERE table_name = 'foo';

It tells you that it is text and there is no character_maximum length.
 If you wish you can test this by entering a 2K string.

But in Perl:

  my $sth = $dbh->prepare("select * from foo");
  $sth->execute();
  print "TYPE: $sth->{TYPE}[0]\nPRECISION: $sth->{PRECISION}[0]\n";

you'll be told that the type is 12 (same as varchar) and the precision
is 80.  This is indistinguishable from a varchar(76), but the types
are very different.

Ben

Reply via email to