aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
Commit message (Collapse)AuthorAge
* TODO marked as done:Bruce Momjian2002-12-12
| | | | | | | | | | | | | | | | | | | | | * Add schema, cast, and conversion backslash commands to psql I had to create a new publically available function, pg_conversion_is_visible, as it seemed to be missing from the catalogs. This required me to do no small amount of hacking around in namespace.c I have updated the \? help and sgml docs. \dc - list conversions [PATTERN] \dC - list casts \dn list schemas I didn't support patterns with casts as there's nothing obvious to match against. Catalog version incremented --- initdb required. Christopher Kings-Lynne
* Here is a patch that does just that, while maintaining theBruce Momjian2002-11-08
| | | | | | | | "traditional" behavior, so the change should be transparent. Use the command "\pset pager always" to turn it on. Anything else does the normal toggle between "on" and "off" Greg Sabino Mullane
* Page \h output and centralize psql paging code in PageOutput().Bruce Momjian2002-10-23
|
* Fix psql to cope with autocommit off, at least during startup.Tom Lane2002-10-15
| | | | | Behavior of backslash commands (especially for large objects) may still require some thought.
* The attached patch fixes a number of issues related to compiling theBruce Momjian2002-10-03
| | | | | | | | | | | | | | | | | | client utilities (libpq.dll and psql.exe) for win32 (missing defines, adjustments to includes, pedantic casting, non-existent functions) per: http://developer.postgresql.org/docs/postgres/install-win32.html. It compiles cleanly under Windows 2000 using Visual Studio .net. Also compiles clean and passes all regression tests (regular and contrib) under Linux. In addition to a review by the usual suspects, it would be very desirable for someone well versed in the peculiarities of win32 to take a look. Joe Conway
* Translation updates, some messages tweaked.Peter Eisentraut2002-09-22
|
* pgindent run.Bruce Momjian2002-09-04
|
* I checked all the previous string handling errors and most of them wereBruce Momjian2002-09-02
| | | | | | | | | | | | | | | already fixed by You. However there were a few left and attached patch should fix the rest of them. I used StringInfo only in 2 places and both of them are inside debug ifdefs. Only performance penalty will come from using strlen() like all the other code does. I also modified some of the already patched parts by changing snprintf(buf, 2 * BUFSIZE, ... style lines to snprintf(buf, sizeof(buf), ... where buf is an array. Jukka Holappa
* I guess I'd vote for changing the code to beBruce Momjian2002-08-14
| | | | | | | | | | | | | | sys = malloc(strlen(editorName) + strlen(fname) + 10 + 1); if (!sys) return false; sprintf(sys, "exec '%s' '%s'", editorName, fname); (note the added quotes to provide a little protection against spaces and such). Then it's perfectly obvious what the calculation is doing. I don't care about wasting 20-some bytes, but confusing readers of the code is worth avoiding. regards, tom lane
* Put back old code.Bruce Momjian2002-08-13
|
* Change NAMEDATALEN to 64, INDEX_MAX_KEYS/MAX_FUNC_ARGS to 32, per ↵Bruce Momjian2002-08-13
| | | | discussion on hackers.
* psql backslash commands are schema-aware. Pattern matching behaviorTom Lane2002-08-10
| | | | | follows recent pghackers discussion. This commit includes all the relevant fixes from Greg Mullane's patch of 24-June.
* I have committed many support files for CREATE CONVERSION. DefaultTatsuo Ishii2002-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conversion procs and conversions are added in initdb. Currently supported conversions are: UTF-8(UNICODE) <--> SQL_ASCII, ISO-8859-1 to 16, EUC_JP, EUC_KR, EUC_CN, EUC_TW, SJIS, BIG5, GBK, GB18030, UHC, JOHAB, TCVN EUC_JP <--> SJIS EUC_TW <--> BIG5 MULE_INTERNAL <--> EUC_JP, SJIS, EUC_TW, BIG5 Note that initial contents of pg_conversion system catalog are created in the initdb process. So doing initdb required is ideal, it's possible to add them to your databases by hand, however. To accomplish this: psql -f your_postgresql_install_path/share/conversion_create.sql your_database So I did not bump up the version in cataversion.h. TODO: Add more conversion procs Add [CASCADE|RESTRICT] to DROP CONVERSION Add tuples to pg_depend Add regression tests Write docs Add SQL99 CONVERT command? -- Tatsuo Ishii
* Fix \? and \pset pager handling. \? wasn't honoring pager before.Bruce Momjian2002-07-15
|
* Remove traces of NAMEDATALEN and INDEX_MAX_KEYS from psql. Build buffersPeter Eisentraut2002-04-24
| | | | dynamically with PQExpBuffer.
* Reset parenthesis level counter upon \r.Peter Eisentraut2002-03-27
|
* Add psql \dD listing of domains, from Jonathan Eisler.Bruce Momjian2002-03-19
|
* Back out psql domain improvements until domain is applied.Bruce Momjian2002-03-07
|
* Here is a diff of changes to the psql source code implementing a simpleBruce Momjian2002-03-06
| | | | | | | 'list domains' command '\dD'. This is the interface component of rbt@zort.ca's domain backend modifications. Jonathan Eisler
* Add \timing patch to psql. Times all queries.Bruce Momjian2002-03-05
| | | | Greg Sabino Mullane
* Tweak psql's \connect command to not downcase unquoted database and userTom Lane2002-02-25
| | | | | | | | names. This is a temporary measure to allow backwards compatibility with 7.2 and earlier pg_dump. 7.2.1 and later pg_dump will double-quote mixed case names in \connect. Once we feel that older dumps are not a problem anymore, we can revert this change and treat \connect arguments as normal SQL identifiers.
* Fix comment.Tom Lane2002-02-20
|
* Add missing 'else', per report from sugita@sra.co.jp.Tom Lane2002-01-18
|
* New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian2001-11-05
| | | | initdb/regression tests pass.
* Another pgindent run. Fixes enum indenting, and improves #endifBruce Momjian2001-10-28
| | | | spacing. Also adds space for one-line comments.
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-25
| | | | tests pass.
* Tatsuo Ishii <t-ishii@sra.co.jp> writes:Bruce Momjian2001-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | > As you can see, psql reconnect as any user if the password is same as > foo. Of course this is due to the careless password setting, but I > think it's better to prompt ANY TIME the user tries to switch to > another user. Comments? Yeah, I agree. Looks like a simple change in dbconnect(): /* * Use old password if no new one given (if you didn't have an old * one, fine) */ if (!pwparam && oldconn) pwparam = PQpass(oldconn); to /* * Use old password (if any) if no new one given and we are * reconnecting as same user */ if (!pwparam && oldconn && PQuser(oldconn) && userparam && strcmp(PQuser(oldconn), userparam) == 0) pwparam = PQpass(oldconn); regards, tom lane
* Attached is the updated version of the patch, which matchesBruce Momjian2001-10-05
| | | | | | | | | | | | | | | | on words as opposed to lines, which means that all of the following work in psql: \d foo \d bar \d foo; \d bar \d foo \d bar;; \d foo; <space> This one also uses "true and false" and strips semicolons for the following backslash commands: \C \c \d \e \i \o \s \z Greg Sabino Mullane
* > NOTE: in the command.c in three places there (I believe) is a typo:Bruce Momjian2001-09-10
| | | | | | | | | | | | > > "parse error at [the] end of line" > > Attached patch also fixes it. I noticed this while editing the po file. > If I'm wrong, please ignore the command.c.patch. I will revert my translation > as well then. > > -- > Serguei A. Mokhov
* Parse the arguments of \connect as SQL identifiers, so that they exposePeter Eisentraut2001-09-02
| | | | | | the expected behavior in mixed-case situations. bug report from James Pattie, 2001-08-31
* Finish German translation, edit (original) messages a bit.Peter Eisentraut2001-06-08
|
* Native Language Support (NLS)Peter Eisentraut2001-06-02
| | | | | | | | | | | Use --enable-nls to turn it on; see installation instructions for details. See developer's guide how to make use of it in programs and how to add translations. psql sources have been almost fully prepared and an incomplete German translation has been provided. In the backend, only elog() calls are currently translatable, and the provided German translation file is more of a placeholder.
* Add command '\pset footer' to psql to turn off default "(x rows)" footer.Peter Eisentraut2001-05-12
|
* Add comment to explain need for bizarre-looking coding in HandleSlashCmds.Tom Lane2001-05-12
|
* Here's a version of my suggested diffs transplanted to 7.1 beta 5. I'mBruce Momjian2001-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | still looking at the best way to integrate Tom Vijlbrief's fixes (insofar as they're still needed); would 7.2 be a suitable time for incompatible API changes? Jeroen Changes: (*) Introduced bool, true, false (replacing some int, 1, 0) (*) Made some member functions const (*) Documented GetIsNull() (*) Marked DisplayTuples() and PrintTuples() as obsolescent; fixed possible portability problem (assumed that NULL pointer equals all-zero bit pattern) (*) PrintTuples(): renamed width parameter to fillAlign to conform with other usage; fixed memory leak and compile issue w.r.t. field separator (should also slightly improve performance) (*) Fixed some minor compilation issues (*) Moved "using namespace std;" out of headers, where they didn't belong; used new (temporary) preprocessor macro PGSTD to do this (*) Made ToString() static, removed unneeded memset(), made buffer size adapt to sizeof(int) (*) Made some constructors explicit (*) Changed some const std::string & parameters to plain std::string (*) Marked PgCursor::Cursor(std::string) as obsolescent (setter with same name as getter--bad style) (*) Renamed some paramaters previously named "string" (*) Introduced size_type typedef for number of tuples in result set (*) PgTransaction now supports re-opening after closing, and aborts if not explicitly committed prior to destruction J. T. Vermeulen
* Add \cd command to psql.Peter Eisentraut2001-05-07
|
* Fix collateral damage from previous (rev 1.49) patch.Peter Eisentraut2001-05-06
|
* Repair misbehavior of \! with immediately following argument that containsPeter Eisentraut2001-04-18
| | | | spaces (e.g., '\!ls -l'). Also correct a comment.
* pgindent run. Make it all clean.Bruce Momjian2001-03-22
|
* Fix a bug in psql. unescape() does not work for multi-byte encodings.Tatsuo Ishii2001-02-17
|
* Restructure the key include files per recent pghackers discussion: thereTom Lane2001-02-10
| | | | | | | | | | | are now separate files "postgres.h" and "postgres_fe.h", which are meant to be the primary include files for backend .c files and frontend .c files respectively. By default, only include files meant for frontend use are installed into the installation include directory. There is a new make target 'make install-all-headers' that adds the whole content of the src/include tree to the installed fileset, for use by people who want to develop server-side code without keeping the complete source tree on hand. Cleaned up a whole lot of crufty and inconsistent header inclusions.
* Here is an update on the Win32 patch. Modified files are 'config.h.win32'Bruce Momjian2001-01-27
| | | | | | | | | | | | | | | | | and two 'win32.mak'. Addresses the following: 1) Oops. Spelled fcntl.h wrong in the last one. D'uh. 2) PG_VERSION changed to be defined with " around it. psql/command.c failed to compile without that. 3) Changed makefiles to use "/MD" and link both psql and libpq.dll against MSVCRT.DLL instead of a static library. This takes care of the crash-upon-free in psql. I *think* this is what is on the "Open 7.1 Items" list as "Magnus Hagander ODBC Issues?". It has nothing to do with ODBC, but it's the only issue I've been involved with... Magnus Hagander
* Here is a patch to make the current snapshot compile on Win32 (native, libpqBruce Momjian2001-01-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and psql) again. Changes are: 1) psql requires the includes of "io.h" and "fcntl.h" in command.c in order to make a call to open() work (io.h for _open(), fcntl.h for the O_xxx) 2) PG_VERSION is no longer defined in version.h[.in], but in configure.in. Since we don't do configure on native win32, we need to put it in config.h.win32 :-( 3) Added define of SYSCONFDIR to config.h.win32 - libpq won't compile without it. This functionality is *NOT* tested - it's just defined as "" for now. May work, may not. 4) DEF_PGPORT renamed to DEF_PGPORT_STR I have done the "basic tests" on it - it connects to a database, and I can run queries. Haven't tested any of the fancier functions (yet). However, I stepped on a much bigger problem when fixing psql to work. It no longer works when linked against the .DLL version of libpq (which the Makefile does for it). I have left it linked against this version anyway, pending the comments I get on this mail :-) The problem is that there are strings being allocated from libpq.dll using PQExpBuffers (for example, initPQExpBuffer() on line 92 of input.c). These are being allocated using the malloc function used by libpq.dll. This function *may* be different from the malloc function used by psql.exe - only the resulting pointer must be valid. And with the default linking methods, it *WILL* be different. Later, psql.exe tries to free() this string, at which point it crashes because the free() function can't find the allocated block (it's on the allocated blocks list used by the runtime lib of libpq.dll). Shouldn't the right thing to do be to have psql call termPQExpBuffer() on the data instead? As it is now, gets_fromFile() will just return the pointer received from the PQExpBuffer.data (this may well be present at several places - this is the one I was bitten by so far). Isn't that kind of "accessing the internals of the PQExpBuffer structure" wrong? Instead, perhaps it shuold make a copy of the string, adn then termPQExpBuffer() it? In that case, the string will have been allocated from within the same library as the free() is called. I can get it to work just fine by doing this - changing from (around line 100 of input.c): and the same a bit further down in the same function. But, as I said above, this may be at more places in the code? Perhaps someone more familiar to it could comment on that? What do you think shuld be done about this? Personally, I go by the "If you allocate a piece of memory using an interface, use the same interface to free it", but the question is how to make it work :-) Also, AFAIK this only affects psql.exe, so the changes made to the libpq this patch are required no matter how the other issue is handled. Regards, Magnus
* Remove incorrect assert.Peter Eisentraut2000-12-30
|
* Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane2000-12-03
| | | | | values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
* Pay attention to failure returns from fgets() in all cases.Tom Lane2000-11-27
| | | | Avoid infinite loop prompting for password at stdin EOF.
* Silence warningPeter Eisentraut2000-11-26
|
* Fix security problem with psql \e where temp file could be an existingBruce Momjian2000-11-25
| | | | symlink created by someone else, and therefore modifyable by someone else.
* Remove -k unix socketpath option from client side, allow hostname withBruce Momjian2000-11-13
| | | | leading slash to behave as a unix socket path.
* UUNET is looking into offering PostgreSQL as a part of a managed webBruce Momjian2000-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hosting product, on both shared and dedicated machines. We currently offer Oracle and MySQL, and it would be a nice middle-ground. However, as shipped, PostgreSQL lacks the following features we need that MySQL has: 1. The ability to listen only on a particular IP address. Each hosting customer has their own IP address, on which all of their servers (http, ftp, real media, etc.) run. 2. The ability to place the Unix-domain socket in a mode 700 directory. This allows us to automatically create an empty database, with an empty DBA password, for new or upgrading customers without having to interactively set a DBA password and communicate it to (or from) the customer. This in turn cuts down our install and upgrade times. 3. The ability to connect to the Unix-domain socket from within a change-rooted environment. We run CGI programs chrooted to the user's home directory, which is another reason why we need to be able to specify where the Unix-domain socket is, instead of /tmp. 4. The ability to, if run as root, open a pid file in /var/run as root, and then setuid to the desired user. (mysqld -u can almost do this; I had to patch it, too). The patch below fixes problem 1-3. I plan to address #4, also, but haven't done so yet. These diffs are big enough that they should give the PG development team something to think about in the meantime :-) Also, I'm about to leave for 2 weeks' vacation, so I thought I'd get out what I have, which works (for the problems it tackles), now. With these changes, we can set up and run PostgreSQL with scripts the same way we can with apache or proftpd or mysql. In summary, this patch makes the following enhancements: 1. Adds an environment variable PGUNIXSOCKET, analogous to MYSQL_UNIX_PORT, and command line options -k --unix-socket to the relevant programs. 2. Adds a -h option to postmaster to set the hostname or IP address to listen on instead of the default INADDR_ANY. 3. Extends some library interfaces to support the above. 4. Fixes a few memory leaks in PQconnectdb(). The default behavior is unchanged from stock 7.0.2; if you don't use any of these new features, they don't change the operation. David J. MacKenzie