Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ... - Mailing list pgsql-hackers

From zengman
Subject Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Date
Msg-id tencent_570729007E2B2BF4741F3737@qq.com
Whole thread Raw
In response to Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...  (VASUKI M <vasukianand0119@gmail.com>)
Responses Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
List pgsql-hackers
> Added a safety guard before calling PQescapeLiteral() to ensure pset.db is non-NULL and in CONNECTION_OK state,
fallingback to ALL otherwise.
 

Hi, VASUKI M

I just looked at this patch and thought about it briefly, but I'm a little confused about the purpose of this
conditionalcheck. 
 
If the condition is met, then returning anything at this point makes no sense, right?

```
if (!pset.db || PQstatus(pset.db) != CONNECTION_OK)
{
    COMPLETE_WITH("ALL");
}
```

Furthermore, I believe this should be guaranteed by the function `exec_query`.

```
COMPLETE_WITH_QUERY_PLUS -> COMPLETE_WITH_QUERY_LIST -> complete_from_query -> exec_query
```

However, I haven't had time to debug it yet, so I might need your help to double-check it.

--
Regards,
Man Zeng
www.openhalo.org

pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: [PATCH] Expose checkpoint reason to completion log messages.
Next
From: VASUKI M
Date:
Subject: Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...