From 4b70629b92185a3d5c5a39e224f38564d1e4fed6 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 24 Oct 2000 04:13:28 +0000
Subject: [PATCH] Rejigger do_lo_list's query so that obj_description() is
 evaluated only once per distinct LO, not once per pg_largeobject tuple.

---
 src/bin/psql/large_obj.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c
index 5cfd18c328f..f97fab1a6c9 100644
--- a/src/bin/psql/large_obj.c
+++ b/src/bin/psql/large_obj.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.11 2000/10/24 01:38:39 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.12 2000/10/24 04:13:28 tgl Exp $
  */
 #include "postgres.h"
 #include "large_obj.h"
@@ -328,9 +328,8 @@ do_lo_list(void)
 	printQueryOpt myopt = pset.popt;
 
 	strcpy(buf,
-	"SELECT DISTINCT loid as \"ID\",\n"
-		   "  obj_description(loid) as \"Description\"\n"
-		   "FROM pg_largeobject\n"
+	"SELECT loid as \"ID\", obj_description(loid) as \"Description\"\n"
+		   "FROM (SELECT DISTINCT loid FROM pg_largeobject) x\n"
 		   "ORDER BY \"ID\"");
 
 	res = PSQLexec(buf);
-- 
GitLab