dropPrimaryKey without constraint name on sql server doesn't query schema correctly

Description

Since the fix for https://liquibase.jira.com/browse/CORE-2172#icft=CORE-2172 the schema is considered but not necessarily correct in every case.
I'm trying to drop a primary key as follows:

<dropPrimaryKey tableName="MY_TABLE" />

The generated INNER JOIN to the sysusers table does not work in my case since the current database user name is not equal to the schema name.

Instead of the join to sysusers I suggest to replace it with join to sys.schemas:

INNER JOIN sys.schemas s ON o.uid = s.schema_id ... and s.name='MY_SCHEMA'

Environment

MSSQL-Server

Activity

Show:

Björn Kautler August 28, 2015 at 9:30 AM

Björn Kautler August 28, 2015 at 9:29 AM

This is heavily broken in 3.4.1.
If you do a dropPrimaryKey without constraint name on MSSQL with 3.4.1, you just get an error that "schemas" is not known.

Nathan Voxland June 19, 2015 at 3:58 PM

Made suggested change, thanks

Fixed

Details

Reporter

Fix versions

Affects versions

Priority

Created June 5, 2015 at 8:50 AM
Updated August 28, 2015 at 9:30 AM
Resolved June 19, 2015 at 3:58 PM

Flag notifications