Re: pgcrypto

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Ramesh T <rameshparnanditech(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgcrypto
Date: 2015-09-23 22:31:05
Message-ID: CAMkU=1wj7G2F3mXbLT7m4v8HgM=T+4bpFNNsBqVe-DUCV=jaOA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 23, 2015 at 8:46 AM, Ramesh T <rameshparnanditech(at)gmail(dot)com>
wrote:

> Hi,
> i created extension pgcrypto on public with postgres user.But
> while trying to use from my own schma suppose qa.
>
> when i run digest in function in my qa
>
> CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
> SELECT encode(digest($1, 'sha1'), 'hex')
> $$ LANGUAGE SQL STRICT IMMUTABLE;
>

If "public" is not in your search_path, then you need to schema-qualify the
name of the function when you use it:

CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $
SELECT encode(public.digest($1, 'sha1'), 'hex')
$ LANGUAGE SQL STRICT IMMUTABLE;

It is a good idea to do that anyway.

Cheers,

Jeff

In response to

  • pgcrypto at 2015-09-23 15:46:33 from Ramesh T

Browse pgsql-general by date

  From Date Subject
Next Message Raymond Brinzer 2015-09-24 01:32:02 Automatically Updatable Foreign Key Views
Previous Message Merlin Moncure 2015-09-23 18:20:35 Re: OR vs UNION vs UNION ALL