Re: Casting - Mailing list pgsql-sql

From Tom Lane
Subject Re: Casting
Date
Msg-id 11650.1016057455@sss.pgh.pa.us
Whole thread Raw
In response to Casting  ("Graham Vickrage" <graham@digitalplanit.com>)
List pgsql-sql
"Graham Vickrage" <graham@digitalplanit.com> writes:
> I essentially need the last four digits of the number (securing
> credit card numbers is the idea), which I can only do by manipulating text
> and casting it back.

What's wrong with a modulo operation?

regression=# select '123456789'::int8 % 10000::int8;?column? 
----------    6789
(1 row)
        regards, tom lane


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Referential integrity implementation - bug or user error?
Next
From: Stephan Szabo
Date:
Subject: Re: Line Numbering in SELRCT Output