From: thomas at tada.se (Thomas Hallgren) Date: Thu, 18 May 2006 14:34:16 +0200 Subject: [Pljava-dev] ResultSet getString In-Reply-To: References: <446C5033.2000508@lewczuk.com> <446C55FE.2020902@tada.se> Message-ID: <446C69C8.3030908@tada.se> Marek Lewczuk wrote: > Ok, I thought that getString() will return any postgresql type as string > - e.g. varchar[] would be {"val","val"}, boolean would be "t" or "f" - > that is how pgsql works, when assigning value of any type to variable > defined as text/varchar. > > I see what you mean. Question is, what string representation should be used? What is more intuitive? Using the Java 'toString()' representation of an object or the PostgreSQL String representation of the SQL type? A typical Java developer who's not fluent in PostgreSQL type coercion would expect that ResultSet.getString() on a boolean would return "true" or "false", i.e. something that can be passed to Boolean.valueOf(String) and that Array types would follow the format stipulated by java.util.Arrays.toString([]) family of methods. At present, the getString() method will coerce basic types to strings using Java semantics. Arrays are not coerced though, since that functionality was introduced in Java 1.5. Regards, Thomas Hallgren