Tim Landscheidt <tim(at)tim-landscheidt(dot)de> writes:
> Jerrel Kemper <jerrel(at)s-wise(dot)nl> wrote:
>> How can I have the same result set as above
>> Name
>> 001
>> 01
>> 1
>> with the name field defined as character varying.
> Ah! Your excentric formatting and the reference to "serial"
> had me wondering if the indentation had any meaning. You can
> select the rows where the "Name" field is numerically equal
> to 1 by casting it to an integer and then comparing it to 1,
> i. e.:
> | SELECT Name FROM Test WHERE Name::INT = 1;
But note that this is going to throw an error if there are any table
rows where the name field *doesn't* contain a valid integer.
regards, tom lane