Using right() in a view

From: Chrishelring <christianhelring(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using right() in a view
Date: 2011-05-23 14:10:36
Message-ID: 1306159836605-4419141.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2011-05-23 16:37:22 Re: Using right() in a view
Previous Message Tom Lane 2011-05-23 14:05:08 Re: disable seqscan