Use (BIG)SERIAL in generated SQL when this was used when column

originally defined.

This is recognized by the fact that the column has a dependency on a
sequence. For columns that happen to have a default which uses a pre
exising sequence the dependency is the other way around.
This commit is contained in:
eelke 2019-12-01 06:40:11 +01:00
parent 817a371220
commit 2c2253f75e
3 changed files with 26 additions and 9 deletions

View file

@ -30,7 +30,7 @@ public:
QString options;
QString defaultValue; ///< Comes from pg_attrdef table
QString sername, serschema; // serial sequence name and schema
bool operator==(Key _k) const { return relid == std::get<0>(_k) && num == std::get<1>(_k); }
bool operator==(const QString &n) const { return name == n; }
@ -41,6 +41,8 @@ public:
QString columnDefinition(const PgDatabaseCatalog &cat) const;
QString alterTableAddColumn(const PgDatabaseCatalog &cat, const PgClass &table) const;
QString alterTableDropColumn(const PgDatabaseCatalog &cat, const PgClass &table) const;
bool isSerial() const { return !sername.isEmpty(); }
};
#endif // PGATTRIBUTE_H