Re: Transition relation clarification

2024-01-02 Thread Dull Bananas
The documentation is not specific enough about what a transition table is
or what it means to create a transition table, so I assumed that it works
similarly to `CREATE TEMPORARY TABLE`. The existence of variable-like
tables is not documented.

On Mon, Jan 1, 2024 at 10:22 David G. Johnston 
wrote:

> On Mon, Jan 1, 2024 at 9:35 AM Dull Bananas 
> wrote:
>
>> The docs should mention that transition relations aren't automatically
>> made available in functions called by the trigger function. This unknown
>> behavior caused a lot of frustration for me.
>
>
> Seems to fall into the "if it isn't documented it doesn't happen" category
> of things that we simply choose not to clutter the documentation with.
> Called functions don't inherit stuff from the caller.  It is like
> documenting a variable in the calling function isn't visible to the called
> function.  Admittedly at least with variables you can pass them via
> arguments.  The special trigger state is indeed available in the trigger
> returning function when it is the function directly invoked by the trigger.
>
> David J.
>


Problems when using unaccent

2024-01-02 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/unaccent.html
Description:

I'm trying to query a database with unaccent, but PostgreSQL gives me
exceptions:

ERROR:  function unaccent(character varying) does not exist at character
139
HINT:  No function matches the given name and argument types. You might need
to add explicit type casts.
STATEMENT:  SELECT "cidades"."id", "cidades"."nome", "cidades"."populacao",
"cidades"."estado_id", "cidades"."complemento" FROM "cidades" WHERE
UPPER(UNACCENT("cidades"."nome")::text) LIKE '%' ||
UPPER(REPLACE(REPLACE(REPLACE((UNACCENT('ara')), E'\\', E''), E'%',
E'\\%'), E'_', E'\\_')) || '%' ORDER BY "cidades"."nome" ASC LIMIT 21

This query is being generated according to parameters passed by Django.
Example:

cidades.filter(**{'nome__unaccent__icontains': termo_selecao_cidade})


Re: Problems when using unaccent

2024-01-02 Thread Tom Lane
PG Doc comments form  writes:
> I'm trying to query a database with unaccent, but PostgreSQL gives me
> exceptions:

> ERROR:  function unaccent(character varying) does not exist at character
> 139

It looks like you haven't installed the unaccent extension in that
database.  See

https://www.postgresql.org/docs/current/contrib.html

regards, tom lane