psql editor temp file extension
psql editor temp file extension
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
There was a question recently on a user list about how to configure an editor to handle psql's editor temp files as SQL files. While this is doable with an advanced editor by reverse-engineering the file pattern than psql uses, it would be easier if psql just added an extension ".sql". Since both uses (\e and \ef) are actually SQL files, this should not be a problem. So I propose the attached patch. diff --git i/src/bin/psql/command.c w/src/bin/psql/command.c index 9cc73be..f885c1d 100644 --- i/src/bin/psql/command.c +++ w/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
Re: psql editor temp file extension
От:
Pavel Stehule <pavel.stehule@gmail.com>
Дата:
2011/11/29 Peter Eisentraut : > There was a question recently on a user list about how to configure an > editor to handle psql's editor temp files as SQL files. While this is > doable with an advanced editor by reverse-engineering the file pattern > than psql uses, it would be easier if psql just added an extension > ".sql". Since both uses (\e and \ef) are actually SQL files, this > should not be a problem. So I propose the attached patch. +1 Pavel > > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > >