Re: UUID generation problem

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Paul Förster <paul(dot)foerster(at)gmail(dot)com>, byrnejb(at)harte-lyne(dot)ca
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: UUID generation problem
Date: 2020-10-05 17:20:02
Message-ID: 4a62a2ea-1fca-3049-3929-3191f52924e2@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/5/20 9:19 AM, Paul Förster wrote:
> Hi James,
>
>> On 05. Oct, 2020, at 17:57, James B. Byrne <byrnejb(at)harte-lyne(dot)ca> wrote:
>>
>> [root(at)accounting-2 ~ (master)]# psql --dbname=idempiere
>> --username=idempiere_dbadmin
>> Password for user idempiere_dbadmin:
>> psql (11.8)
>> Type "help" for help.
>>
>> idempiere=# select current_schemas(true);
>> current_schemas
>> ------------------------
>> {adempiere,pg_catalog}
>> (1 row)
>>
>> idempiere=# select uuid_generate_v4();
>> ERROR: function uuid_generate_v4() does not exist
>> LINE 1: select uuid_generate_v4();
>> ^
>> HINT: No function matches the given name and argument types. You might need to
>> add explicit type casts.
>> idempiere=# select public.uuid_generate_v4();
>> uuid_generate_v4
>> --------------------------------------
>> 066e3298-3c91-4079-98ee-2b279bfc4025
>> (1 row)
>
> just out of curiosity, what does the search_path contain? It needs not necessarily reflect the contents of current_schemas, see the following example:
>
> postgres=# select current_schemas(true);
> current_schemas
> ------------------------------
> {pg_catalog,postgres,public}
> (1 row)
>
> postgres=# select current_schemas(false);
> current_schemas
> -------------------
> {postgres,public}
> (1 row)
>
> postgres=# show search_path;
> search_path
> -----------------
> "$user", public
> (1 row)

Actually it does:

From the prompt I'm guessing you are logging in as 'postgres' user. In
that case "$user" will become postgres and you will get:

postgres=# select current_schemas(false);
current_schemas
-------------------
{postgres,public}

The current_schemas(true) case will include implicit schemas that are
'always'(as I'm sure that someone will come up with the exception) there.

>
> Cheers,
> Paul
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Förster 2020-10-05 17:22:34 Re: UUID generation problem
Previous Message James B. Byrne 2020-10-05 17:16:43 Re: UUID generation problem