STORAGE clause support, COMPRESS clause support

This commit is contained in:
lsv 2023-08-15 20:40:22 +05:00
parent 4ffd790d48
commit 0caf3dbf7f
5 changed files with 59 additions and 14 deletions

View file

@ -28,7 +28,7 @@
/*
* List of (keyword-name, keyword-token-value) pairs.
*/
#define PG_KEYWORD(a,b,c) {a,c},
#define PG_KEYWORD(a,b,c,d) {a,c},
const ScanKeyword ScanKeywords[] = {
#ifdef WIN32

View file

@ -245,6 +245,14 @@ public:
{
generated = s;
}
void iSetCompression(const wxString& s)
{
compression = s;
}
wxString GetCompression() const
{
return compression == "p" ? "pglz" : (compression == "l" ? "lz4" : "");
}
wxString GetIdentity() const
{
return identity;
@ -315,7 +323,7 @@ public:
private:
wxString varTypename, quotedTypename, defaultVal, tableName, quotedFullTable, defaultStorage, storage, rawTypename;
wxString serialSequence, serialSchema, pkCols, inheritedTableName, collation, generated, identity;
wxString serialSequence, serialSchema, pkCols, inheritedTableName, collation, generated, identity, compression;
long colNumber, length, precision, statistics, attstattarget;
long typlen, typmod, inheritedCount;
bool isPK, isFK, notNull, isArray, isLocal;

View file

@ -314,6 +314,18 @@ wxString pgColumn::GetDefinition()
if (table->GetOfTypeOid() == 0)
sql += GetQuotedTypename();
if (GetDatabase()->BackendMinimumVersion(16, 0))
{
if (GetStorage() != GetDefaultStorage())
sql += " STORAGE " + GetStorage();
}
if (GetDatabase()->BackendMinimumVersion(14, 0))
{
wxString cmp = GetCompression();
if (!cmp.IsEmpty())
sql += " COMPRESSION " + GetCompression();
}
if (!GetCollation().IsEmpty() && GetCollation() != wxT("pg_catalog.\"default\""))
sql += wxT(" COLLATE ") + GetCollation();
@ -668,6 +680,11 @@ pgObject *pgColumnFactory::CreateObjects(pgCollection *coll, ctlTree *browser, c
{
column->iSetGenerated(columns->GetVal(wxT("attgenerated")));
};
if (database->BackendMinimumVersion(14, 0))
{
wxString compres = columns->GetVal(wxT("attcompression"));
column->iSetCompression(compres);
}

View file

@ -422,7 +422,8 @@ wxString pgTable::GetSql(ctlTree *browser)
if (colDetails.Length() > 0)
if (colDetails.Last() != '\n')
colDetails += wxT("\n");
colDetails += column->GetStorageSql();
if (!GetDatabase()->BackendMinimumVersion(16, 0))
colDetails += column->GetStorageSql();
if (colDetails.Length() > 0)
if (colDetails.Last() != '\n')
colDetails += wxT("\n");

View file

@ -35282,7 +35282,7 @@ static unsigned char xml_res_file_78[] = {
47,111,98,106,101,99,116,62,10,60,47,114,101,115,111,117,114,99,101,62,
10};
static size_t xml_res_size_79 = 69254;
static size_t xml_res_size_79 = 69671;
static unsigned char xml_res_file_79[] = {
60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101,
110,99,111,100,105,110,103,61,34,73,83,79,45,56,56,53,57,45,49,34,63,62,
@ -35682,15 +35682,34 @@ static unsigned char xml_res_file_79[] = {
32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,52,60,
47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,
62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,
62,119,120,69,88,80,65,78,68,124,119,120,84,79,80,124,119,120,76,69,70,
84,124,119,120,82,73,71,72,84,60,47,102,108,97,103,62,10,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,52,60,47,
98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,
108,97,115,115,61,34,115,105,122,101,114,105,116,101,109,34,62,10,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,111,98,106,
101,99,116,32,99,108,97,115,115,61,34,119,120,67,104,101,99,107,66,111,
120,34,32,110,97,109,101,61,34,99,104,107,78,117,109,98,101,114,80,114,
101,116,116,121,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,66,101,97,117,116,105,102,
117,108,32,98,105,103,32,110,117,109,98,101,114,115,32,111,110,32,116,104,
101,32,115,116,97,116,105,115,116,105,99,115,32,112,97,103,101,60,47,108,
97,98,101,108,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,48,60,47,99,104,101,
99,107,101,100,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,103,62,119,120,
69,88,80,65,78,68,124,119,120,84,79,80,124,119,120,76,69,70,84,124,119,
120,82,73,71,72,84,60,47,102,108,97,103,62,10,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,52,
60,47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,
32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,
116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,60,102,108,97,
103,62,119,120,69,88,80,65,78,68,124,119,120,84,79,80,124,119,120,76,69,
70,84,124,119,120,82,73,71,72,84,60,47,102,108,97,103,62,10,32,32,32,32,
32,32,32,32,32,32,32,32,32,32,32,32,60,98,111,114,100,101,114,62,52,60,
47,98,111,114,100,101,114,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,115,105,122,101,
114,105,116,101,109,34,62,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,80,97,
110,101,108,34,32,110,97,109,101,61,34,112,110,108,66,114,111,119,115,101,