forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support 'DROP INDEX table.index' and 'DROP INDEX ix ON schema.table' (b…
…abelfish-for-postgresql#2216) To support the syntax DROP INDEX table.index, the statement is rewritten in ANTLR as DROP INDEX index ON table, which is picked up by the backend parser. To support the syntax DROP INDEX schema.table.index and DROP INDEX index ON schema.table, the statement is rewritten in ANTLR as DROP INDEX index ON table SCHEMA schema, which is picked up by the backend parser. Adding the SCHEMA clause for this case was necessary to avoid Bison reduce conflicts which resulted from seemingly more straightforward syntax options. In the backend parser, the trick is then to create an object reference in the DropStmt structure for the schema-qualified index with the schema name from the SCHEMA clause that was added, since PG's DROP INDEX only references the index, instead of its table like in T-SQL. Also, proper error messages are now raised when attempting DROP INDEX with a 3-part of 4-part name. Signed-off-by: Rob Verschoor [email protected] Issues Resolved BABEL-1483 Support DROP INDEX table.index syntax BABEL-1652 Support DROP INDEX ix ON schema.table syntax
- Loading branch information
1 parent
c0bdda9
commit b8e0ab9
Showing
11 changed files
with
977 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use master | ||
go | ||
drop table guest.t1_drop_index | ||
go | ||
drop table dbo.t1_drop_index | ||
go | ||
drop procedure dbo.p1_drop_index | ||
go | ||
drop procedure dbo.p2_drop_index | ||
go | ||
|
||
use tempdb | ||
go | ||
drop table guest.t1_drop_index | ||
go | ||
drop table dbo.t1_drop_index | ||
go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use master | ||
go | ||
|
||
create procedure p1_drop_index @p int=0 | ||
as | ||
if @p = 0 | ||
drop index guest.t1_drop_index.ix1 | ||
else | ||
drop index if exists guest.t1_drop_index.ix1 | ||
select db_name(), object_name(id), object_schema_name(id), name from sysindexes where name like 'ix1%' order by 1,2,3,4 | ||
go | ||
|
||
|
||
create procedure p2_drop_index @p int=0 | ||
as | ||
if @p = 0 | ||
drop index ix1 on guest.t1_drop_index | ||
else | ||
drop index if exists ix1 on guest.t1_drop_index | ||
select db_name(), object_name(id), object_schema_name(id), name from sysindexes where name like 'ix1%' order by 1,2,3,4 | ||
go | ||
|
||
use tempdb | ||
go | ||
|
Oops, something went wrong.