Fix #264 -- Don't detect an index creation during a transaction with an exclusive lock, when the table is being created
Improve documentation on this issue.
This commit is contained in:
1 parent
c2c0d5886a
commit
eb59c472fb
4 files changed
+50
-21
No files matched your search
@@ -315,6 +315,13 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
|
||||
'CREATE INDEX ON "films" ((lower("title")));',
|
||||
]
|
||||
self.assertValidSql(sql)
|
||||
sql = [
|
||||
'CREATE TABLE "films" ("title" text);',
|
||||
'ALTER TABLE "films" ADD CONSTRAINT "title_not_empty" CHECK (char_length("title") > 0)'
|
||||
'CREATE INDEX ON "films" ((lower("title")));',
|
||||
]
|
||||
self.assertValidSql(sql)
|
||||
# Not the same column or tables.
|
||||
sql = [
|
||||
'CREATE TABLE "some_table" ("title" text);',
|
||||
'CREATE INDEX ON "films" ((lower("title")));',
|
||||
@@ -363,6 +370,23 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
|
||||
]
|
||||
self.assertWarningSql(sql, code="CREATE_INDEX_EXCLUSIVE")
|
||||
|
||||
def test_create_index_exclusive_with_prior_table_creation(self):
|
||||
sql = [
|
||||
"BEGIN;",
|
||||
'CREATE TABLE "users" ("email" text);',
|
||||
'CREATE INDEX "user_email" ON "users" ("email");',
|
||||
"COMMIT;",
|
||||
]
|
||||
self.assertValidSql(sql)
|
||||
sql = [
|
||||
"BEGIN;",
|
||||
'CREATE TABLE "users" ("id" number);',
|
||||
'ALTER TABLE "users" ADD COLUMN "email" varchar(254) NULL;',
|
||||
'CREATE INDEX "user_email" ON "users" ("email");',
|
||||
"COMMIT;",
|
||||
]
|
||||
self.assertValidSql(sql)
|
||||
|
||||
def test_create_concurrently_index_exclusive(self):
|
||||
sql = [
|
||||
"BEGIN;",
|
||||
|
||||
Reference in new issue
Block a user