Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants