Обсуждение: Error while running restore

Поиск
Список
Период
Сортировка

Error while running restore

От
Márcio Antônio Sepp
Дата:

 

Hi all,

 

 

I’m getting this error message when try to restore a database :

 

ERROR:  function f_validanumero_cnpj_cpf(character) does not exist

LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)

                ^

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)

CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em IF

COPY esp_altera_estoque, line 1, column nr_cnpjcpf: "24614011000120"

 

 

The funny is that i’m restoring the database to the same Server.

Steps:

pg_dump dbname > dumpfile

 

Create new database and restoring with:

psql < dumpfile

 

 

Witch making mistakes do am i making?

 

In this case, the database is small and if I open the dumpfile with a notepad and split in 2 files and run after other it works fine.

 

 

--

Att

Márcio A. Sepp

 

RES: Error while running restore

От
Márcio Antônio Sepp
Дата:

 

Ops, Server version tested are:
PostgreSQL 11.5

and

PostgreSQL 13.1

 

In both cases, i’m making dump and restore to the same Server.

 

 

--

Att

Márcio A. Sepp

 

De: Márcio Antônio Sepp [mailto:marcio@zyontecnologia.com.br]
Enviada em: quinta-feira, 21 de janeiro de 2021 14:53
Para: pgsql-general@postgresql.org
Assunto: Error while running restore

 

 

Hi all,

 

 

I’m getting this error message when try to restore a database :

 

ERROR:  function f_validanumero_cnpj_cpf(character) does not exist

LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)

                ^

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)

CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em IF

COPY esp_altera_estoque, line 1, column nr_cnpjcpf: "24614011000120"

 

 

The funny is that i’m restoring the database to the same Server.

Steps:

pg_dump dbname > dumpfile

 

Create new database and restoring with:

psql < dumpfile

 

 

Witch making mistakes do am i making?

 

In this case, the database is small and if I open the dumpfile with a notepad and split in 2 files and run after other it works fine.

 

 

--

Att

Márcio A. Sepp

 

Re: Error while running restore

От
Tom Lane
Дата:
=?iso-8859-1?Q?M=E1rcio_Ant=F4nio_Sepp?= <marcio@zyontecnologia.com.br> writes:
> I’m getting this error message when try to restore a database :
> ERROR:  function f_validanumero_cnpj_cpf(character) does not exist
> LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
>                 ^
> HINT:  No function matches the given name and argument types. You might need
> to add explicit type casts.
> QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em IF

It looks like f_testacnpjcpf() is making unwarranted assumptions about what
search_path it's invoked under.  You could try schema-qualifying the
reference to f_validanumero_cnpj_cpf, or adding an explicit "SET
search_path" clause to f_testacnpjcpf().

            regards, tom lane



Re: Error while running restore

От
Adrian Klaver
Дата:
On 1/21/21 9:52 AM, Márcio Antônio Sepp wrote:
> Hi all,
> 
> I’m getting this error message when try to restore a database :
> 
> ERROR:  function f_validanumero_cnpj_cpf(character) does not exist
> 
> LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> 
>                  ^
> 
> HINT:  No function matches the given name and argument types. You might 
> need to add explicit type casts.
> 
> QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> 
> CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em IF
> 
> COPY esp_altera_estoque, line 1, column nr_cnpjcpf: "24614011000120"
> 
> The funny is that i’m restoring the database to the same Server.
> 
> Steps:
> 
> pg_dump /dbname/> /dumpfile/
> 
> Create new database and restoring with:
> 
> psql <|/dumpfile/|
> 
> Witch making mistakes do am i making?
> 
> In this case, the database is small and if I open the dumpfile with a 
> notepad and split in 2 files and run after other it works fine.

Split where?

Is this function being used in a TRIGGER on esp_altera_estoque?

> 
> --
> 
> Att
> 
> Márcio A. Sepp
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



RES: Error while running restore

От
Márcio Antônio Sepp
Дата:
Hi

> > I’m getting this error message when try to restore a database :
> > ERROR:  function f_validanumero_cnpj_cpf(character) does not exist
> > LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> >                 ^
> > HINT:  No function matches the given name and argument types. You might
> need
> > to add explicit type casts.
> > QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> > CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em IF
>
> It looks like f_testacnpjcpf() is making unwarranted assumptions about what
> search_path it's invoked under.  You could try schema-qualifying the
> reference to f_validanumero_cnpj_cpf, or adding an explicit "SET
> search_path" clause to f_testacnpjcpf().

Thank you. Setting set search_path to f_testacnpjcpf() works fine.

Thank you Tom! Thanks list!





RES: Error while running restore [SOLVED]

От
Márcio Antônio Sepp
Дата:
> > Hi all,
> >
> > I’m getting this error message when try to restore a database :
> >
> > ERROR:  function f_validanumero_cnpj_cpf(character) does not exist
> >
> > LINE 1: SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> >
> >                  ^
> >
> > HINT:  No function matches the given name and argument types. You might
> > need to add explicit type casts.
> >
> > QUERY:  SELECT (f_validanumero_cnpj_cpf(trim(cnpj_cpf)::char)=false)
> >
> > CONTEXT:  função PL/pgSQL public.f_testacnpjcpf(character) linha 31 em
> IF
> >
> > COPY esp_altera_estoque, line 1, column nr_cnpjcpf: "24614011000120"
> >
> > The funny is that i’m restoring the database to the same Server.
> >
> > Steps:
> >
> > pg_dump /dbname/> /dumpfile/
> >
> > Create new database and restoring with:
> >
> > psql <|/dumpfile/|
> >
> > Witch making mistakes do am i making?
> >
> > In this case, the database is small and if I open the dumpfile with a
> > notepad and split in 2 files and run after other it works fine.
>
> Split where?
Dabase is very small. I open the dump file and with Ctrl X and Ctrl V I
create 2 news files. Than run in order each file.

> Is this function being used in a TRIGGER on esp_altera_estoque?
yes

Thank You Adrian and list!