This is something that I have wanted to do every now and again, but I don't know how to do this cleanly in DBI. Is there an official DBI way to bind a column as 'DEFAULT'?
For example, let us say that I wanted to do this insert: my $sth = $dbh->prepare(q{ INSERT INTO foo (col0, col1, col2, col3) VALUES (DEFAULT, :col1, :col2, :col3) }); if ('col1_is_default') { # How do I do this bind? # hack that should work with DBD::mysql & DBD::Pg $sth->bind_param(":col1", 'DEFAULT' SQL_INTEGER); # Could probably add an attribute {(pg|mysql)_default=>1}? } else { $sth->bind_param(":col1" Not default); } for (my $x;;$x++) { $sth->bind_param("col2", "foo $_"); $sth->bind_param("col3", "bar $_"); $sth->execute; } Rudy