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

sql: store dependencies in pg_depend #56115

Closed
jayshrivastava opened this issue Oct 29, 2020 · 1 comment · Fixed by #57240
Closed

sql: store dependencies in pg_depend #56115

jayshrivastava opened this issue Oct 29, 2020 · 1 comment · Fixed by #57240
Labels
A-sql-pgcatalog A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-vtables Virtual tables - pg_catalog, information_schema etc C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@jayshrivastava
Copy link
Contributor

We do not track dependencies in the table pg_catalog.pd_depend. Instead we use crdb_internal.forward_dependencies.

create table foo(i int);
CREATE TABLE

create view bar as select i from foo;
CREATE VIEW

select * from crdb_internal.forward_dependencies;
  descriptor_id | descriptor_name | index_id | dependedonby_id | dependedonby_type | dependedonby_index_id | dependedonby_name | dependedonby_details
----------------+-----------------+----------+-----------------+-------------------+-----------------------+-------------------+-----------------------
            461 | foo             |     NULL |             462 | view              |                     0 | NULL              | Columns: [1]
(2 rows)

root@localhost:26257/defaultdb> select * from pg_catalog.pg_depend;
  classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
----------+-------+----------+------------+----------+-------------+----------
(0 rows)

Describe the solution you'd like
For postgres compatibility, we should populate pg_depends.

@jayshrivastava jayshrivastava added the A-sql-vtables Virtual tables - pg_catalog, information_schema etc label Oct 29, 2020
@blathers-crl
Copy link

blathers-crl bot commented Oct 29, 2020

Hi @jayshrivastava, please add a C-ategory label to your issue. Check out the label system docs.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@jayshrivastava jayshrivastava added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-pgcompat Semantic compatibility with PostgreSQL labels Oct 29, 2020
mnovelodou pushed a commit to mnovelodou/cockroach that referenced this issue Nov 30, 2020
Previously, pg_depend only contained dependencies from foreign keys,
but this table in postgres also cointains dependencies from table-views,
To address this, this patch populates this dependency information

Fixes cockroachdb#56115

Release note (sql change): added table-view dependency information
in pg_depend to improve compatibility with postgresql.
mnovelodou pushed a commit to mnovelodou/cockroach that referenced this issue Dec 3, 2020
Previously, pg_depend only contained dependencies from foreign keys,
but this table in postgres also cointains dependencies from table-views,
To address this, this patch populates this dependency information

Fixes cockroachdb#56115

Release note (sql change): added table-view dependency information
in pg_depend to improve compatibility with postgresql.
craig bot pushed a commit that referenced this issue Dec 11, 2020
57240: sql: populated pg_depend with table and view dependencies r=rafiss a=mnovelodou

Previously, pg_depend only contained dependencies from foreign keys,
but this table in postgres also cointains dependencies from table-views,
To address this, this patch populates this dependency information

Fixes #56115

Release note (sql change): added table-view dependency information
in pg_depend to improve compatibility with postgresql.

Co-authored-by: MiguelNovelo <[email protected]>
@craig craig bot closed this as completed in c723c40 Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcatalog A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-vtables Virtual tables - pg_catalog, information_schema etc C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants