Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create a user same name function as pg_catalog.array_in caused the getSQLTypeQuery fail #2548

Open
xiaozhongwang opened this issue Jun 17, 2022 · 0 comments

Comments

@xiaozhongwang
Copy link

Please read https://stackoverflow.com/help/minimal-reproducible-example

Describe the issue
A clear and concise description of what the issue is.
create a user function and the name is same as array_in in user schema, like as public.

Driver Version?
latest version

Java Version?
JDK 1.8

OS Version?
CentOS 7

PostgreSQL Version?
PostgreSQL 12

To Reproduce
Steps to reproduce the behaviour:

create a user function

CREATE OR REPLACE FUNCTION public.array_in(anyarray, oid, integer)
 RETURNS anyarray
 LANGUAGE internal
 STABLE PARALLEL SAFE STRICT
AS $function$array_in$function$
;

make sure the function is created

the result as following

postgres=# \df array_in
                            List of functions
   Schema   |   Name   | Result data type |  Argument data types   | Type
------------+----------+------------------+------------------------+------
 pg_catalog | array_in | anyarray         | cstring, oid, integer  | func
 public     | array_in | anyarray         | anyarray, oid, integer | func
(2 rows)

execute the sql in getSQLTypeQuery

postgres=# SELECT typinput='array_in'::regproc as is_array, typtype, typname, pg_type.oid   FROM pg_catalog.pg_type   LEFT JOIN (select ns.oid as nspoid, ns.nspname, r.r           from pg_namespace as ns     join ( select s.r, (current_schemas(false))[s.r] as nspname                    from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as r          using ( nspname )        ) as sp    ON sp.nspoid = typnamespace  WHERE pg_type.oid = $1  ORDER BY sp.r, pg_type.oid DESC
postgres-# ;
ERROR:  more than one function named "array_in"
LINE 1: SELECT typinput='array_in'::regproc as is_array, typtype, ty...
                        ^
postgres=# 

Expected behaviour
A clear and concise description of what you expected to happen.
And what actually happens

Logs
If possible PostgreSQL logs surrounding the occurrence of the issue
Additionally logs from the driver can be obtained adding

Using the following template code make sure the bug can be replicated in the driver alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant