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: allow table and column renaming if only references are in udfs #101934

Open
rharding6373 opened this issue Apr 20, 2023 · 0 comments
Open

sql: allow table and column renaming if only references are in udfs #101934

rharding6373 opened this issue Apr 20, 2023 · 0 comments
Labels
A-sql-routine UDFs and Stored Procedures C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team

Comments

@rharding6373
Copy link
Collaborator

rharding6373 commented Apr 20, 2023

Postgres allows tables and columns to be renamed using ALTER TABLE even if they are referenced by UDFs. For example, the following commands succeed in postgres:

CREATE TABLE t_twocol (a INT, b INT);

CREATE FUNCTION f_unqualified_twocol() RETURNS t_twocol AS
$$
  SELECT * FROM t_twocol;
$$ LANGUAGE SQL;

-- CRDB failure: cannot rename column "a" because function "f_unqualified_twocol" depends on it
ALTER TABLE t_twocol RENAME COLUMN a TO d;

-- CRDB failure: cannot rename relation "t_twocol" because function "f_unqualified_twocol" depends on it
ALTER TABLE t_twocol RENAME TO t_twocol_prime;

This should be possible once we're able to rewrite queries with table and column IDs.

Jira issue: CRDB-27189

@rharding6373 rharding6373 added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-routine UDFs and Stored Procedures labels Apr 20, 2023
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Apr 20, 2023
rharding6373 added a commit to rharding6373/cockroach that referenced this issue Apr 20, 2023
Epic: none
Informs: cockroachdb#101934

Release note: none
rharding6373 added a commit to rharding6373/cockroach that referenced this issue Apr 20, 2023
Epic: none
Informs: cockroachdb#101934

Release note: none
craig bot pushed a commit that referenced this issue Apr 20, 2023
98466: cli,server: static configuration profiles r=stevendanna a=knz

Epic: CRDB-23559
Informs #98431. 
Fixes #94856.
(Based off #98459)
Supersedes #98380.

This change introduces a mechanism through which an operator can
select a "configuration profile" via the command-line flag
`--config-profile` or env var `COCKROACH_CONFIG_PROFILE`. The SQL
initialization defined by the profile is applied during server
start-up.

The profiles are (currently) hardcoded inside CockroachDB.

The following profiles are predefined:

- `default`: no configuration.

- `multitenant+noapp`: no pre-defined `application` tenant, but with a
  predefined application tenant template that is used whenever a new
  tenant is defined. This config profile is meant for use for C2C
  replication target clusters.

- `multitenant+app+sharedservice`: shared-process multitenancy with
  pre-defined `application` tenant, based off the same configuration as
  `multitenant+noapp`.

Release note: None

101907: multitenant: misc fixes related to tenant capabilities r=arulajmani a=knz

See individual commits for details.

The last commit in particular probably addresses #99087.

Epic: CRDB-23559

101935: sql: add issue number to todo r=rharding6373 a=rharding6373

Epic: none
Informs: #101934

Release note: none

Co-authored-by: Raphael 'kena' Poss <[email protected]>
Co-authored-by: rharding6373 <[email protected]>
@mgartner mgartner moved this to New Backlog in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-routine UDFs and Stored Procedures C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team
Projects
Status: Backlog
Development

No branches or pull requests

1 participant