On 18/11/2008 17:33, Andrus wrote: > create temp table test (test char(20)); > insert into test values ('12'); > insert into test values ('23/3'); > insert into test values ('AX/3'); > select max(test::int) from test; > > but got > > ERROR: invalid input syntax for integer: "23/3 " > > How to fix this so that this query returns 23 without error ? It's not a question of "fixing" - it's not broken! :-) You could use a regular expression in substring() to get just the numeric bits. Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@xxxxxx Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general