[ 
https://issues.apache.org/jira/browse/HAWQ-628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15237965#comment-15237965
 ] 

ASF GitHub Bot commented on HAWQ-628:
-------------------------------------

Github user GodenYao commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/595#discussion_r59453051
  
    --- Diff: src/backend/utils/adt/dbsize.c ---
    @@ -180,9 +180,7 @@ calculate_database_size(Oid dbOid)
        Assert(Gp_role != GP_ROLE_EXECUTE);
     
        if (dbOid == HcatalogDbOid)
    -           ereport(ERROR,
    -                   (ERRCODE_UNDEFINED_DATABASE,
    -                   errmsg("database hcatalog (OID 6120) is reserved")));
    +           return -1;
    --- End diff --
    
    This is to solve incompatibility with psql clients (not hawq client). In 
hawq client, we hide hcatalog from being displayed in \l or \l+. But with other 
psql clients, if we error out in dbsize, \l and \l+ will also error out and 
show nothing.
    
    A compromise solution, which we implemented here is to return hcatalog 
dbsize as -1. Based on my investigation and interview with some users they 
think -1 is better than 0, as it's not a valid size info, so users who may rely 
on this value can adjust their logic to exclude hcatalog as necessary.


> \l+ returns hcatalog not supported error
> ----------------------------------------
>
>                 Key: HAWQ-628
>                 URL: https://issues.apache.org/jira/browse/HAWQ-628
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: Hcatalog, PXF
>            Reporter: Goden Yao
>            Assignee: Oleksandr Diachenko
>             Fix For: 2.0.0
>
>
> This is likely not from HAWQ client
> {code}
> gpadmin=# \l+
> ERROR:  database hcatalog (OID 6120) is reserved (dbsize.c:185)
> gpadmin=# \l
>                  List of databases
>    Name    |  Owner  | Encoding | Access privileges
> -----------+---------+----------+-------------------
>  gpadmin   | gpadmin | UTF8     |
>  hcatalog  | gpadmin | UTF8     |
>  lc_demo   | gpadmin | UTF8     |
>  postgres  | gpadmin | UTF8     |
>  template0 | gpadmin | UTF8     |
>  template1 | gpadmin | UTF8     |
> (6 rows)
> {code}
> *Expected Behavior*
> 1. show hcatalog under \l+ normally with as much information as we can provide
> 2. we'll list hcatalog dbsize as "-1" in l+ mode to make it not error out for 
> other psql compatible clients



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to