Using right() in a view - Mailing list pgsql-general

From Chrishelring
Subject Using right() in a view
Date
Msg-id 1306159836605-4419141.post@n5.nabble.com
Whole thread Raw
Responses Re: Using right() in a view  (Bosco Rama <postgres@boscorama.com>)
List pgsql-general
Hi all,

please foregive me for this rather trivial question, but I´ve worked in it
for quite som time and could use som help now. :)

I have a table where it want to create a idkey using our municipality number
+ the road number + the housenumber.

The municipality and housenumber is in a fixed size, so they are okay. But
the road number differs from two digits up to four. I was then thinking
about doing something like this:

CREATE OR REPLACE VIEW test AS
SELECT
  right(cast('000' as text) || cast(road_number as text), 4) AS GEO_ADRESSE

FROM rk_ois.bbrbygning
WHERE ejerlav <> 0

to ensure that the road_number would be a fixed size (four digitis).
Unfortunately this doesn't work.

Any idea on how to solve this?

Christian

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Using-right-in-a-view-tp4419141p4419141.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: disable seqscan
Next
From: Chitra Vasamsetty
Date:
Subject: Postgre Client only install on Linux- 8.4.7