d == dalroi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx writes: d> On May 26, 2009, at 6:37 PM, Brandon Metcalf wrote: d> > j> option 2: case when '$length' = '' ... d> > d> > j> you can use case like this: d> > d> > j> UPDATE foo d> > j> SET d> > j> pattern = '$pattern', d> > j> shape = '$shape', d> > j> length = case when '$length'='' then length else d> > '$length' end, d> > j> comment = '$comment' d> > j> WHERE foo_id = $foo_id d> > d> > j> here you can substitute any value you choose for the empty string, d> > j> 0 or NULL may (or may not) be more apropriate. d> > d> > d> > The issue here is that these reduce back to my original problem. For d> > example, if I use a CASE statement and I fall through to the ELSE, d> > then the SQL is attempting to insert a "''" in a NUMERIC field which d> > is not valid. That is, it's trying to do d> No it doesn't, read that statement again ;) Oops. Indeed, you are correct. -- Brandon -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general