mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 19:20:17 +08:00
PostgreSQL: Make TPGConnection.FetchDbObjects compatible to pre-9.0 servers. See http://www.heidisql.com/forum.php?t=16996
This commit is contained in:
@ -4218,7 +4218,7 @@ procedure TPGConnection.FetchDbObjects(db: String; var Cache: TDBObjectList);
|
|||||||
var
|
var
|
||||||
obj: TDBObject;
|
obj: TDBObject;
|
||||||
Results: TDBQuery;
|
Results: TDBQuery;
|
||||||
tp, SchemaTable: String;
|
tp, SchemaTable, SizeClause: String;
|
||||||
begin
|
begin
|
||||||
// Tables, views and procedures
|
// Tables, views and procedures
|
||||||
Results := nil;
|
Results := nil;
|
||||||
@ -4228,8 +4228,13 @@ begin
|
|||||||
SchemaTable := 'QUOTE_IDENT(t.TABLE_SCHEMA) || '+EscapeString('.')+' || QUOTE_IDENT(t.TABLE_NAME)'
|
SchemaTable := 'QUOTE_IDENT(t.TABLE_SCHEMA) || '+EscapeString('.')+' || QUOTE_IDENT(t.TABLE_NAME)'
|
||||||
else
|
else
|
||||||
SchemaTable := EscapeString(FQuoteChar)+' || t.TABLE_SCHEMA || '+EscapeString(FQuoteChar+'.'+FQuoteChar)+' || t.TABLE_NAME || '+EscapeString(FQuoteChar);
|
SchemaTable := EscapeString(FQuoteChar)+' || t.TABLE_SCHEMA || '+EscapeString(FQuoteChar+'.'+FQuoteChar)+' || t.TABLE_NAME || '+EscapeString(FQuoteChar);
|
||||||
|
// See http://www.heidisql.com/forum.php?t=16996
|
||||||
|
if ServerVersionInt >= 90000 then
|
||||||
|
SizeClause := 'pg_table_size('+SchemaTable+')'
|
||||||
|
else
|
||||||
|
SizeClause := 'NULL';
|
||||||
Results := GetResults('SELECT *,'+
|
Results := GetResults('SELECT *,'+
|
||||||
' pg_table_size('+SchemaTable+') AS data_length,'+
|
' '+SizeClause+' AS data_length,'+
|
||||||
' pg_relation_size('+SchemaTable+') AS index_length,'+
|
' pg_relation_size('+SchemaTable+') AS index_length,'+
|
||||||
' c.reltuples, obj_description(c.oid) AS comment'+
|
' c.reltuples, obj_description(c.oid) AS comment'+
|
||||||
' FROM '+QuoteIdent('information_schema')+'.'+QuoteIdent('tables')+' AS t'+
|
' FROM '+QuoteIdent('information_schema')+'.'+QuoteIdent('tables')+' AS t'+
|
||||||
|
Reference in New Issue
Block a user