Re: Casting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Graham Vickrage" <graham(at)digitalplanit(dot)com>
Cc: "Postgres SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Casting
Date: 2002-03-13 22:10:55
Message-ID: 11650.1016057455@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Graham Vickrage" <graham(at)digitalplanit(dot)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

In response to

  • Casting at 2002-03-13 17:41:24 from Graham Vickrage

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-03-14 01:01:39 Re: Line Numbering in SELRCT Output
Previous Message Brian Knox 2002-03-13 21:28:00 Strange Postgresql Indexing Behavior