Re: [HACKERS] psql: server version check for \dO

2012-05-10 Thread Magnus Hagander
On Thu, May 10, 2012 at 7:09 AM, Josh Kupershmidt schmi...@gmail.com wrote:
 Hi all,

 I think psql's \dO command is missing the server version check which
 similar commands such as \dx use. Right now \dO errors out with:

 test=# \dO
 ERROR:  relation pg_catalog.pg_collation does not exist

 when talking to servers older than 9.1, which don't have pg_collation.
 Simple patch for listCollations() attached.

Indeed. Thanks, applied and backpatched to 9.1.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] psql: server version check for \dO

2012-05-09 Thread Josh Kupershmidt
Hi all,

I think psql's \dO command is missing the server version check which
similar commands such as \dx use. Right now \dO errors out with:

test=# \dO
ERROR:  relation pg_catalog.pg_collation does not exist

when talking to servers older than 9.1, which don't have pg_collation.
Simple patch for listCollations() attached.

Josh
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
new file mode 100644
index 8dfb570..2cfacd3
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
*** listCollations(const char *pattern, bool
*** 3061,3066 
--- 3061,3073 
  	printQueryOpt myopt = pset.popt;
  	static const bool translate_columns[] = {false, false, false, false, false};
  
+ 	if (pset.sversion  90100)
+ 	{
+ 		fprintf(stderr, _(The server (version %d.%d) does not support collations.\n),
+ pset.sversion / 1, (pset.sversion / 100) % 100);
+ 		return true;
+ 	}
+ 
  	initPQExpBuffer(buf);
  
  	printfPQExpBuffer(buf,

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers