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

Reduce number of parameters #54

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions sql/possible_object_name_overflow.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ with
select current_setting('max_identifier_length')::int as max_identifier_length
),

nsp as (
select
nsp.oid,
nsp.nspname
from pg_catalog.pg_namespace nsp
where
nsp.nspname = :schema_name_param::text
),

long_names as (
select
pc.oid::regclass::text as object_name,
Expand All @@ -33,11 +42,10 @@ with
end as object_type
from
pg_catalog.pg_class pc
inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace
inner join nsp on nsp.oid = pc.relnamespace
inner join t on t.max_identifier_length = length(pc.relname)
where
pc.relkind in ('r', 'i', 'S', 'v', 'm') and
nsp.nspname = :schema_name_param::text
pc.relkind in ('r', 'i', 'S', 'v', 'm')

union all

Expand All @@ -46,10 +54,8 @@ with
'function' as object_type
from
pg_catalog.pg_proc p
inner join pg_catalog.pg_namespace nsp on nsp.oid = p.pronamespace
inner join nsp on nsp.oid = p.pronamespace
inner join t on t.max_identifier_length = length(p.proname)
where
nsp.nspname = :schema_name_param::text

union all

Expand All @@ -58,10 +64,8 @@ with
'constraint' as object_type
from
pg_catalog.pg_constraint c
inner join pg_catalog.pg_namespace nsp on nsp.oid = c.connamespace
inner join nsp on nsp.oid = c.connamespace
inner join t on t.max_identifier_length = length(c.conname)
where
nsp.nspname = :schema_name_param::text
)

select *
Expand Down