How does your DBI driver represent a default column value in the results
returned by the column_info() method?

Specifically, does it distinguish between default literal strings and
default functions/expressions?

Consider the difference between these two column definitions

    bar1 timestamp not null default 'current_timestamp',
    bar2 timestamp not null default  current_timestamp,

or, more generally:

    foo1 varchar(20) not null default 'current_user',
    foo2 varchar(20) not null default  current_user,

This issue has cropped up in relation to a bug Jos has filed against
DBIx::Class::Schema::Loader: https://rt.cpan.org/Ticket/Display.html?id=46412

The ODBC 3.0 spec says
http://web.archive.org/web/20070513203826/http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlcolumns.asp

    The default value of the column. The value in this column should be
    interpreted as a string *if it is enclosed in quotation marks*.

    If NULL was specified as the default value, then this column is the word
    NULL, not enclosed in quotation marks. If the default value cannot be
    represented without truncation, then this column contains TRUNCATED,
    with no enclosing single quotation marks. If no default value was
    specified, then this column is NULL.

    *The value of COLUMN_DEF can be used in generating a new column
    definition*, except when it contains the value TRUNCATED.

(The *emphasis* is mine.)

So, people, what does your database driver do for these cases?
Are COLUMN_DEF values for literal defaults returned by column_info()
enclosed in quotation marks?

Tim.

Reply via email to