commit 02ac7130865765b5dc1080f99399ac339145d685
Author: Tom Hughes <tom@compton.nu>
Date:   Wed Jun 14 13:07:33 2023 +0100

    Make catalog enumeration with SQLTables work.

diff --git a/info.c b/info.c
index 37f1d49..23db5a3 100644
--- a/info.c
+++ b/info.c
@@ -1898,7 +1898,8 @@ retry_public_schema:
 	initPQExpBuffer(&tables_query);
 #define	return	DONT_CALL_RETURN_FROM_HERE???
 	if (list_cat)
-		appendPQExpBufferStr(&tables_query, "select NULL, NULL, NULL");
+		appendPQExpBufferStr(&tables_query, "select datname, NULL, NULL"
+			" from pg_catalog.pg_database");
 	else if (list_table_types)
 	{
 		/*
@@ -2165,7 +2166,9 @@ retry_public_schema:
 		{
 			tuple = QR_AddNew(res);
 
-			if (list_cat || !list_some)
+			if (list_cat)
+				set_tuplefield_string(&tuple[TABLES_CATALOG_NAME], table_name);
+			else if (!list_some)
 				set_tuplefield_string(&tuple[TABLES_CATALOG_NAME], CurrCat(conn));
 			else
 				set_tuplefield_null(&tuple[TABLES_CATALOG_NAME]);
