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

Datashare add schema tables #65

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gargrishabh75
Copy link

Currently when a schema is added to datashare, all its tables are automatically added.
In this PR we have introduced a new parameter schema_tables to specify schema tables to be added to datashare

}

func resourceRedshiftDatashareRemoveTablesInSchema(tx *sql.Tx, shareName string, tables string) error {
query := fmt.Sprintf("ALTER DATASHARE %s REMOVE TABLE %s", pq.QuoteIdentifier(shareName), pq.QuoteIdentifier(tables))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested that it will actually work for more than one table in the list? To my knowledge, this will produce an SQL like ALTER DATASHARE "xyz" REMOVE TABLE "schema.table1,schema.table2" which will try to remove the table named "schema.table1,schema.table2" as one name rather than 2 separate tables (due to double quotes). The same would apply to ADD TABLE query.

I'm asking, because I've faced a similar issue with removing users from groups and had to quote each name individually before joining. See https://github.com/brainly/terraform-provider-redshift/blob/master/redshift/resource_redshift_group.go#L228-L232

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

Successfully merging this pull request may close these issues.

2 participants