From b6f9834a9e8dfab1bd503ec0357bb812a18018a2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Fri, 2 Dec 2011 23:38:33 +0200
Subject: [PATCH] psql: Make temporary editor files have .sql extension

This gives editors a better chance to treat these files as the SQL
files that they are.
---
 src/bin/psql/command.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 9cc73beabff..f885c1d74fe 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1879,10 +1879,10 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf,
 		 */
 #endif
 #ifndef WIN32
-		snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d", tmpdir,
+		snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d.sql", tmpdir,
 				 "/", (int) getpid());
 #else
-		snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d", tmpdir,
+		snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d.sql", tmpdir,
 			   "" /* trailing separator already present */ , (int) getpid());
 #endif
 
-- 
GitLab