Fixed an issue where the count query should not be triggered when the estimated count is less than zero. #5904

This commit is contained in:
Akshay Joshi 2023-03-07 16:16:34 +05:30
parent ca33283930
commit 17f18e795f
3 changed files with 8 additions and 11 deletions

View File

@ -35,3 +35,4 @@ Bug fixes
| `Issue #5775 <https://github.com/pgadmin-org/pgadmin4/issues/5775>`_ - Display the 'No menu available for this object' message if the selected tree node does not have any options.
| `Issue #5833 <https://github.com/pgadmin-org/pgadmin4/issues/5833>`_ - Fixed an issue where user MFA entry was not getting delete after deleting a user.
| `Issue #5874 <https://github.com/pgadmin-org/pgadmin4/issues/5874>`_ - Make "using" and "with check" fields a textarea in the RLS policy.
| `Issue #5904 <https://github.com/pgadmin-org/pgadmin4/issues/5904>`_ - Fixed an issue where the count query should not be triggered when the estimated count is less than zero.

View File

@ -79,13 +79,13 @@ export default class RowSecurityPolicySchema extends BaseUISchema {
},
{
id: 'using', label: gettext('Using'), deps: ['using', 'event'],
type: 'multiline', disabled: obj.disableUsingField,
type: 'sql', disabled: obj.disableUsingField,
mode: ['create', 'edit', 'properties'],
control: 'sql', visible: true, group: gettext('Commands'),
},
{
id: 'withcheck', label: gettext('With check'), deps: ['withcheck', 'event'],
type: 'multiline', mode: ['create', 'edit', 'properties'],
type: 'sql', mode: ['create', 'edit', 'properties'],
control: 'sql', visible: true, group: gettext('Commands'),
disabled: obj.disableWithCheckField,
},

View File

@ -612,14 +612,14 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
# version 9.5 and above
BaseTableView._check_rlspolicy_support(res)
# If estimated_row_count is zero or -1 then set the row count to 0
if not estimated_row_count or estimated_row_count < 0:
res['rows'][0]['rows_cnt'] = 0
# If estimated rows are greater than threshold then
if estimated_row_count and \
estimated_row_count > table_row_count_threshold:
elif estimated_row_count > table_row_count_threshold:
res['rows'][0]['rows_cnt'] = str(table_row_count_threshold) + '+'
# If estimated rows is lower than threshold then calculate the count
elif estimated_row_count and \
table_row_count_threshold >= estimated_row_count:
elif 0 < estimated_row_count <= table_row_count_threshold:
sql = render_template(
"/".join(
[self.table_template_path, 'get_table_row_count.sql']
@ -633,10 +633,6 @@ class BaseTableView(PGChildNodeView, BasePartitionTable, VacuumSettings):
res['rows'][0]['rows_cnt'] = count
# If estimated_row_count is zero then set the row count with same
elif not estimated_row_count:
res['rows'][0]['rows_cnt'] = estimated_row_count
# Fetch privileges
sql = render_template("/".join([self.table_template_path,
self._ACL_SQL]),