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_0C77CC5645E519121D45D90B@qq.com
Whole thread Raw
In response to Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...  (Dharin Shah <dharinshah95@gmail.com>)
Responses Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
List pgsql-hackers
> The only thing I’m cautious about is treating “pset.db is NULL/invalid” as just another “quoting failure” case. In
thiscompletion branch we call PQescapeLiteral(pset.db, ...) before we ever reach exec_query(), so an explicit guard is
aboutavoiding passing an unusable handle into libpq in the first place. Even if libpq were to return NULL in that
situation,it’s > not something I’d want to rely on implicitly.
 
> That’s why I suggested the explicit guard: it matches the general psql style of checking !pset.db before calling
libpqAPIs (e.g. psql_get_variable() in src/bin/psql/common.c checks !pset.db before calling PQescapeLiteral()), and it
makesthe intent obviously safe. Behavior-wise it’s the same (fall back to ALL), just more defensive/clear & explicit. 
 
Hi,

Okay, I understand what you mean, thank you.

--
Regards,
Man Zeng
www.openhalo.org

pgsql-hackers by date:

Previous
From: Dharin Shah
Date:
Subject: Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ...
Next
From: Henson Choi
Date:
Subject: Re: Re[2]: [PATCH] Add pg_current_vxact_id() function to expose virtual transaction IDs