Skip to content
Snippets Groups Projects
  1. Jul 10, 2014
    • Fujii Masao's avatar
      Add new ECHO mode 'errors' that displays only failed commands in psql. · 5b214c5d
      Fujii Masao authored
      When the psql variable ECHO is set to 'erros', only failed SQL commands
      are printed to standard error output. Also this patch adds -b option into psql.
      This is equivalent to setting the variable ECHO to 'errors'.
      
      Pavel Stehule, reviewed by Fabrízio de Royes Mello, Samrat Revagade,
      Kumar Rajeev Rastogi, Abhijit Menon-Sen, and me.
      5b214c5d
  2. Mar 10, 2014
    • Tom Lane's avatar
      Fix tracking of psql script line numbers during \copy from another place. · e85a5ffb
      Tom Lane authored
      Commit 08146775 changed do_copy() to
      temporarily scribble on pset.cur_cmd_source.  That was a mighty ugly bit of
      code in any case, but in particular it broke handleCopyIn's ability to tell
      whether it was reading from the current script source file (in which case
      pset.lineno should be incremented for each line of COPY data), or from
      someplace else (in which case it shouldn't).  The former case still worked,
      the latter not so much.  The visible effect was that line numbers reported
      for errors in a script file would be wrong if there were an earlier \copy
      that was reading anything other than inline-in-the-script-file data.
      
      To fix, introduce another pset field that holds the file do_copy wants the
      COPY code to use.  This is a little bit ugly, but less so than passing the
      file down explicitly through several layers that aren't COPY-specific.
      
      Extracted from a larger patch by Kumar Rajeev Rastogi; that patch also
      changes printing of COPY command tags, which is not a bug fix and shouldn't
      get back-patched.  This particular idea was from a suggestion by Amit
      Khandekar, if I'm reading the thread correctly.
      
      Back-patch to 9.2 where the faulty code was introduced.
      e85a5ffb
  3. Mar 02, 2014
    • Stephen Frost's avatar
      Various Coverity-spotted fixes · b1aebbb6
      Stephen Frost authored
      A number of issues were identified by the Coverity scanner and are
      addressed in this patch.  None of these appear to be security issues
      and many are mostly cosmetic changes.
      
      Short comments for each of the changes follows.
      
      Correct the semi-colon placement in be-secure.c regarding SSL retries.
      Remove a useless comparison-to-NULL in proc.c (value is dereferenced
        prior to this check and therefore can't be NULL).
      Add checking of chmod() return values to initdb.
      Fix a couple minor memory leaks in initdb.
      Fix memory leak in pg_ctl- involves free'ing the config file contents.
      Use an int to capture fgetc() return instead of an enum in pg_dump.
      Fix minor memory leaks in pg_dump.
        (note minor change to convertOperatorReference()'s API)
      Check fclose()/remove() return codes in psql.
      Check fstat(), find_my_exec() return codes in psql.
      Various ECPG memory leak fixes.
      Check find_my_exec() return in ECPG.
      Explicitly ignore pqFlush return in libpq error-path.
      Change PQfnumber() to avoid doing an strdup() when no changes required.
      Remove a few useless check-against-NULL's (value deref'd beforehand).
      Check rmtree(), malloc() results in pg_regress.
      Also check get_alternative_expectfile() return in pg_regress.
      b1aebbb6
  4. Feb 15, 2014
    • Tom Lane's avatar
      Centralize getopt-related declarations in a new header file pg_getopt.h. · 60ff2fdd
      Tom Lane authored
      We used to have externs for getopt() and its API variables scattered
      all over the place.  Now that we find we're going to need to tweak the
      variable declarations for Cygwin, it seems like a good idea to have
      just one place to tweak.
      
      In this commit, the variables are declared "#ifndef HAVE_GETOPT_H".
      That may or may not work everywhere, but we'll soon find out.
      
      Andres Freund
      60ff2fdd
  5. Jan 07, 2014
  6. Oct 23, 2013
    • Tom Lane's avatar
      Replace pg_asprintf() with psprintf(). · 2c66f992
      Tom Lane authored
      This eliminates an awkward coding pattern that's also unnecessarily
      inconsistent with backend coding.  psprintf() is now the thing to
      use everywhere.
      2c66f992
  7. Oct 13, 2013
  8. Oct 03, 2013
  9. Jul 01, 2013
  10. Jun 18, 2013
  11. May 29, 2013
  12. Apr 04, 2013
  13. Mar 04, 2013
  14. Jan 01, 2013
  15. Oct 12, 2012
  16. Oct 02, 2012
    • Tom Lane's avatar
      Standardize naming of malloc/realloc/strdup wrapper functions. · a563d941
      Tom Lane authored
      We had a number of variants on the theme of "malloc or die", with the
      majority named like "pg_malloc", but by no means all.  Standardize on the
      names pg_malloc, pg_malloc0, pg_realloc, pg_strdup.  Get rid of pg_calloc
      entirely in favor of using pg_malloc0.
      
      This is an essentially cosmetic change, so no back-patch.  (I did find
      a couple of places where psql and pg_dump were using plain malloc or
      strdup instead of the pg_ versions, but they don't look significant
      enough to bother back-patching.)
      a563d941
  17. Aug 09, 2012
    • Robert Haas's avatar
      Make psql -1 < file behave as expected. · be690e29
      Robert Haas authored
      Previously, the -1 option was silently ignored.
      
      Also, emit an error if -1 is used in a context where it won't be
      respected, to avoid user confusion.
      
      Original patch by Fabien COELHO, but this version is quite different
      from the original submission.
      be690e29
  18. Jun 10, 2012
  19. May 27, 2012
  20. May 01, 2012
  21. Mar 03, 2012
  22. Mar 01, 2012
    • Peter Eisentraut's avatar
      psql: Improve error display for psql -f - · 89c2f573
      Peter Eisentraut authored
      Running "psql -f -" used to print
      
      psql:<stdin>:1: ERROR:  blah
      
      but that got broken between 8.4 and 9.0 (commit
      b291c0fb), and now it printed
      
      psql:-:1: ERROR:  blah
      
      This reverts to the old behavior and cleans up some code that was left
      dead or useless by the mentioned commit.
      89c2f573
  23. Feb 09, 2012
  24. Jan 02, 2012
  25. Oct 15, 2011
  26. Jul 06, 2011
    • Robert Haas's avatar
      Add \ir command to psql. · c7f23494
      Robert Haas authored
      \ir is short for "include relative"; when used from a script, the
      supplied pathname will be interpreted relative to the input file,
      rather than to the current working directory.
      
      Gurjeet Singh, reviewed by Josh Kupershmidt, with substantial further
      cleanup by me.
      c7f23494
  27. Feb 19, 2011
    • Peter Eisentraut's avatar
      Set psql client encoding from locale by default · 02e14562
      Peter Eisentraut authored
      Add a new libpq connection option client_encoding (which includes the
      existing PGCLIENTENCODING environment variable), which besides an
      encoding name accepts a special value "auto" that tries to determine
      the encoding from the locale in the client's environment, using the
      mechanisms that have been in use in initdb.
      
      psql sets this new connection option to "auto" when running from a
      terminal and not overridden by setting PGCLIENTENCODING.
      
      original code by Heikki Linnakangas, with subsequent contributions by
      Jaime Casanova, Peter Eisentraut, Stephen Frost, Ibrar Ahmed
      02e14562
  28. Feb 16, 2011
  29. Jan 01, 2011
  30. Sep 20, 2010
  31. Mar 07, 2010
  32. Mar 06, 2010
  33. Feb 26, 2010
  34. Feb 16, 2010
  35. Feb 05, 2010
    • Joe Conway's avatar
      Modify recently added PQconnectdbParams() with new argument, expand_dbname. · f419a82c
      Joe Conway authored
      If expand_dbname is non-zero and dbname contains an = sign, it is taken as
      a conninfo string in exactly the same way as if it had been passed to
      PQconnectdb. This is equivalent to the way PQsetdbLogin() works, allowing
      PQconnectdbParams() to be a complete alternative.
      
      Also improve the way the new function is called from psql and replace a
      previously missed call to PQsetdbLogin() in psql. Additionally use
      PQconnectdbParams() for pg_dump and friends, and the bin/scripts
      command line utilities such as vacuumdb, createdb, etc.
      
      Finally, update the documentation for the new parameter, as well as the
      nuances of precedence in cases where key words are repeated or duplicated
      in the conninfo string.
      f419a82c
  36. Jan 28, 2010
    • Joe Conway's avatar
      Introduce two new libpq connection functions, PQconnectdbParams and · e3f36838
      Joe Conway authored
      PQconnectStartParams. These are analogous to PQconnectdb and PQconnectStart
      respectively. They differ from the legacy functions in that they accept
      two NULL-terminated arrays, keywords and values, rather than conninfo
      strings. This avoids the need to build the conninfo string in cases
      where it might be inconvenient to do so. Includes documentation.
      
      Also modify psql to utilize PQconnectdbParams rather than PQsetdbLogin.
      This allows the new config parameter application_name to be set, which
      in turn is displayed in the pg_stat_activity view and included in CSV
      log entries. This will also ensure both new functions get regularly
      exercised.
      
      Patch by Guillaume Lelarge with review and minor adjustments by
      Joe Conway.
      e3f36838
  37. Jan 02, 2010
  38. Dec 01, 2009
    • Bruce Momjian's avatar
      psql -f - · b291c0fb
      Bruce Momjian authored
      Adjust psql -f - to behave like a normal file and honor the -1 flag.
      
      Report from Robert Haas
      b291c0fb
  39. Apr 05, 2009
  40. Feb 26, 2009
Loading