提交 9a79f24d authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #508 from ebocher/fixCountOnLinkedTable

Fix count on linked table
...@@ -149,9 +149,9 @@ ALTER VIEW [ IF EXISTS ] viewName RECOMPILE ...@@ -149,9 +149,9 @@ ALTER VIEW [ IF EXISTS ] viewName RECOMPILE
"," ","
Recompiles a view after the underlying tables have been changed or created." Recompiles a view after the underlying tables have been changed or created."
"Commands (DDL)","ANALYZE"," "Commands (DDL)","ANALYZE","
ANALYZE [ SAMPLE_SIZE rowCountInt ] ANALYZE [ TABLE tableName ] [ SAMPLE_SIZE rowCountInt ]
"," ","
Updates the selectivity statistics of all tables." Updates the selectivity statistics of tables."
"Commands (DDL)","COMMENT"," "Commands (DDL)","COMMENT","
COMMENT ON COMMENT ON
{ { COLUMN [ schemaName. ] tableName.columnName } { { COLUMN [ schemaName. ] tableName.columnName }
......
...@@ -445,7 +445,8 @@ public class TableLink extends Table { ...@@ -445,7 +445,8 @@ public class TableLink extends Table {
@Override @Override
public synchronized long getRowCount(Session session) { public synchronized long getRowCount(Session session) {
String sql = "SELECT COUNT(*) FROM " + qualifiedTableName; //The foo alias is used to support the PostgreSQL syntax
String sql = "SELECT COUNT(*) FROM " + qualifiedTableName + " as foo";
try { try {
PreparedStatement prep = execute(sql, null, false); PreparedStatement prep = execute(sql, null, false);
ResultSet rs = prep.getResultSet(); ResultSet rs = prep.getResultSet();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论