> default value of a column using DEFAULT keyword on pgsql 7.3. Example:
> INSERT INTO TEST (varcharfield1, varcharfield2) VALUES ('text', DEFAULT)
> In this case, the "varcharfield2" column would get its default value (as
> defined in CREATE TABLE). I was wondering, how I would do it using
> PreparedStatements? If I prepare an SQL like
> INSERT INTO TEST (varcharfield1, varcharfield2) VALUES (?, ?)
> I need to have some way to set one of the the parameters as DEFAULT, but
> how? Using the current JDBC driver I believe is impossible, probably we
would
> need something like a "setDefault(int)" method in PreparedStatement, where
int
> is the parameter index. What do you think about it?
>
Why not simply remove varcharfield2 from the INSERT statement and let the
database insert that value with the default value? Isn't the purpose of a
default value to have the DB put that value in when none is specified?
David