Moshe Katz - 2018-12-05

I know this is a very old bug, with no activity, but there are now many cases in which extended permission assignment means that the "owner" is entirely useless for determining whether tables exist.

For example, if a database is owned by one role user_a but another role user_b is also given permission to create tables in that database, then tables created by user_b do not show up in the table list when user_a does a query because they are not owned by the database user.

Returning the OID of the currently connected user (as suggested in the original report) is also not going to work in this case, as the currently connected user won't see the tables created by the other user even if the connected user has been granted access to those tables.

I believe that using information_schema.tables is the correct way to do this query, as the documentation says:

Only those tables and views are shown that the current user has access to (by way of being the owner or having some privilege).

This means that it will handle ownership internally without having to check it like the query is doing currently.