pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerrel Kemper <jerrel@s-wise.nl>
To: pgsql-sql@postgresql.org
Subject: How to select text field as interger
Date: Tue, 29 Jun 2010 22:51:00 +0200
Message-ID: <4C2A5CB4.3000601@s-wise.nl> (raw)

Dear members,


My table consist off the following fields


CREATE TABLE test
(
   id bigserial NOT NULL,
   name character varying(100),
    CONSTRAINT logs_pkey PRIMARY KEY (log_id)
)


with value :

ID    Name
1      001
2        01
3          1
4        11

Select name from test where name = '1' ;

results in :

Name
   1


If the 'Name' field was define as a serial the result set ought to be

Name
   001
     01
       1


Question?

How can I have the same result set as above

Name
   001
     01
       1


with the name field defined as character varying.



Thanks



view thread (4+ messages)  latest in thread

Message-ID: <4C2A5CB4.3000601@s-wise.nl>
Permalink:  ../4C2A5CB4.3000601@s-wise.nl/
Also on:    postgresql.org/message-id/4C2A5CB4.3000601@s-wise.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jerrel@s-wise.nl
  Subject: Re: How to select text field as interger
  In-Reply-To: <4C2A5CB4.3000601@s-wise.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox