From: Tom Lane <tgl@sss.pgh.pa.us>
To: Graham Vickrage <graham@digitalplanit.com>
Cc: Postgres SQL <pgsql-sql@postgresql.org>
Subject: Re: Casting
Date: Wed, 13 Mar 2002 17:10:55 -0500
Message-ID: <11650.1016057455@sss.pgh.pa.us> (raw)
In-Reply-To: <NDBBJABDILOPAOOMFJHOOEOADEAA.graham@digitalplanit.com>
References: <NDBBJABDILOPAOOMFJHOOEOADEAA.graham@digitalplanit.com>
"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
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: tgl@sss.pgh.pa.us, graham@digitalplanit.com
Subject: Re: Casting
In-Reply-To: <11650.1016057455@sss.pgh.pa.us>
* 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