Error while running restore

Started by Márcio Antônio Seppabout 5 years ago6 messagesgeneral
Jump to latest
#1Márcio Antônio Sepp
marcio@zyontecnologia.com.br

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

#2Márcio Antônio Sepp
marcio@zyontecnologia.com.br
In reply to: Márcio Antônio Sepp (#1)
RES: Error while running restore

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Márcio Antônio Sepp (#1)
Re: Error while running restore

=?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

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Márcio Antônio Sepp (#1)
Re: Error while running restore

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

#5Márcio Antônio Sepp
marcio@zyontecnologia.com.br
In reply to: Tom Lane (#3)
RES: Error while running restore

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!

#6Márcio Antônio Sepp
marcio@zyontecnologia.com.br
In reply to: Adrian Klaver (#4)
RES: Error while running restore [SOLVED]

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!