Re: describe objects, as in pg_depend

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2010-11-17T15:47:41Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. has_table_privilege spawns scions has_database_privilege, has_function_privilege,

Alvaro Herrera <alvherre@commandprompt.com> writes:
> Excerpts from Tom Lane's message of mi nov 17 12:20:06 -0300 2010:
>> What's the point of the InvalidOid check?

> If the check is not there, the calling query will have to prevent the
> function from being called on rows having OID=0 in pg_depend.  (These
> rows show up in the catalog for pinned objects).

Hmm.  It would be good to document that motivation somewhere.  Also,
for my own taste it would be better to do

	/* for "pinned" items in pg_depend, return null */
	if (!OidIsValid(catalogId))
		PG_RETURN_NULL();

	... straight line code here ...

rather than leave the reader wondering whether there are any other cases
where the function is intended to return null.

Oh, one other gripe: probably better to name it pg_describe_object.

			regards, tom lane