Fix DROP sql for partitioned table.
This commit is contained in:
parent
2ff9577d41
commit
61f90668d8
6 changed files with 33 additions and 4 deletions
|
|
@ -111,7 +111,18 @@ QString PgClass::aclAllPattern() const
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PgClass::ddlTypeName() const
|
||||||
|
{
|
||||||
|
switch (kind)
|
||||||
|
{
|
||||||
|
case RelKind::PartitionedTable: return "PARTITIONED TABLE";
|
||||||
|
return "TABLE";
|
||||||
|
default:
|
||||||
|
return PgNamespaceObject::ddlTypeName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PgClass::createTableSql() const
|
QString PgClass::createTableSql() const
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ enum class RelPersistence {
|
||||||
|
|
||||||
void operator<<(RelPersistence &s, const Pgsql::Value &v);
|
void operator<<(RelPersistence &s, const Pgsql::Value &v);
|
||||||
|
|
||||||
enum class RelKind {
|
enum class RelKind
|
||||||
|
{
|
||||||
Table, // r
|
Table, // r
|
||||||
Index, // i
|
Index, // i
|
||||||
Sequence, // S
|
Sequence, // S
|
||||||
|
|
@ -58,6 +59,9 @@ public:
|
||||||
QString typeName() const override;
|
QString typeName() const override;
|
||||||
QString aclAllPattern() const override;
|
QString aclAllPattern() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QString ddlTypeName() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QString createSqlCache;
|
mutable QString createSqlCache;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ QString PgObject::fullyQualifiedQuotedObjectName() const
|
||||||
|
|
||||||
const PgDatabaseCatalog& PgObject::catalog() const
|
const PgDatabaseCatalog& PgObject::catalog() const
|
||||||
{
|
{
|
||||||
return *m_catalog;
|
return *m_catalog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ QString PgServerObject::aclAllPattern() const
|
||||||
|
|
||||||
QString PgServerObject::dropSql() const
|
QString PgServerObject::dropSql() const
|
||||||
{
|
{
|
||||||
return "DROP " % typeName() % " " % fullyQualifiedQuotedObjectName() % ";";
|
return "DROP " % ddlTypeName() % " " % fullyQualifiedQuotedObjectName() % ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PgServerObject::createSql() const
|
QString PgServerObject::createSql() const
|
||||||
|
|
@ -110,3 +110,8 @@ QString PgServerObject::commentSql() const
|
||||||
+ " IS " + escapeLiteral(description) + ";";
|
+ " IS " + escapeLiteral(description) + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PgServerObject::ddlTypeName() const
|
||||||
|
{
|
||||||
|
return typeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@ public:
|
||||||
virtual QString dropSql() const;
|
virtual QString dropSql() const;
|
||||||
virtual QString createSql() const;
|
virtual QString createSql() const;
|
||||||
QString commentSql() const;
|
QString commentSql() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QString ddlTypeName() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Oid m_ownerOid = InvalidOid;
|
Oid m_ownerOid = InvalidOid;
|
||||||
const PgAuthId * m_owner = nullptr;
|
const PgAuthId * m_owner = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix the SQL to drop a partitioned table should be the same as for a normal table.
|
||||||
|
It should NOT include the word PARTITIONED.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue