awslabs / awslabs/amazon-redshift-utils

v_generate_tbl_ddl incorrectly pulls comments on tables with same name in different schema

Open
#707 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

v_generate_tbl_ddl pulls comments for tables with the same name in different schemas as the join to information_schema."columns" is only joining on table name. Correct this by adding a condition to join on schema as well as shown below:

OLD Line 273:
ON cl.ordinal_position::integer = des.objsubid AND cl.table_name::NAME = c.relname

NEW Line 273:
ON cl.ordinal_position::integer = des.objsubid AND cl.table_name::NAME = c.relname **AND cl.table_schema = n.nspname**

Contributor guide

Open the contributing guide

Research direction

Search the repository for v_generate_tbl_ddl and inspect the join around line 273. Add the schema condition shown in the issue, then verify that comments are matched by both table name and schema for same-named tables.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.