Commit Graph

491 Commits

Author SHA1 Message Date
Bruce Momjian 59f6a57e59 Used modified version of indent that understands over 100 typedefs. 1997-09-08 21:56:23 +00:00
Bruce Momjian 319dbfa736 Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting. 1997-09-08 02:41:22 +00:00
Bruce Momjian 1ccd423235 Massive commit to run PGINDENT on all *.c and *.h files. 1997-09-07 05:04:48 +00:00
Bruce Momjian 868d708188 Add // comments. 1997-09-05 00:09:47 +00:00
Marc G. Fournier 8d1f52ef24 From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] More psql and libpq patches

Well..these would be the last patches until the release (I hope)...
I ran the regression tests while watching psql under purify, and it did
not leak even one byte.

In this patch:

* Plugged a major leak when PSQL reads files for input (either through
  \i options or through -f option)
* Fixed the one remaining leak in PSQL in not clearing PGresult *results
  everywhere it is supposed to. (Thanks Tymm)
* Fixed A small leak in PSQL not clearing all the PGsettings correctly.
* A not-so-obvious (but small) leak in Libpq when PQsetdb fails for any
  reason.
* Added \n to some Libpq error messages to make them easier to digest..
* Finally, added /* PURIFY */ comment to some of the code indicating
  the reason for why it was added/changed...for future developers.
1997-06-06 01:42:02 +00:00
Marc G. Fournier 9a5529f4d1 From: Igor <igor@sba.miami.edu>
Subject: [PATCHES] memory leak patches in libpq and psql

A couple of small memory leak patches (detected with Purify) primarily
in libpq.

* Fixed (NULL) border problem in psql (run psql, do \m, then select
  something from a table...row separators will be nulls)
* Fixed memory leak with the abovementioned border not being freed
  properly.
* Fixed memory leak in freePGconn() not freeing conn->port
* Fixed up PQclear() to free parts of PGresult only if these
  parts are not null.
* Fixed a decent memory leak that occured after executing every command
  in psql. PGresult *results was not freed most of the time.

There is still a leak being detected (2 bytes) in readline functions, but
I think this is old readline library. I will install new one and test it.
1997-06-01 15:39:08 +00:00
Bruce Momjian a1157deb57 Added fcvt() prot for bsdi.
Made PQsetdb() and PQfnumber() case-insensitive.
Removed attempt to set table ownership via pg_dumpall.
1997-05-20 03:39:02 +00:00
Bruce Momjian b6b41172f6 fix for sizeof pointed out by Ed Buddington 1997-05-13 01:46:00 +00:00
Marc G. Fournier 498d2d1edc From: Edmund Mergl <E.Mergl@bawue.de>
Subject: [PATCHES] libpq patch

Hi,

here is a small patch which fixes two problems:

1. libpq/libpq-fe.h:

somehow disappeared the line

#define DefaultOption ""

now compilation stops with an error complainig an
unknown DefaultOption (970508).


2. Same patch as I sent already twice, but it never made it
  into the source tree:  there is no default value for
  AuthType and Password. This way any libpq-application
  (i.e. perl-scripts) which use the function PQconnectdb
  will break with PostgreSQL-6.1. The patch simply uses
  an empty string as default value.
1997-05-09 03:28:54 +00:00
Marc G. Fournier 8217202134 From: "Martin J. Laubach" <mjl@CSlab.tuwien.ac.at>
Subject: [PATCHES] libpq SET var TO patch

  One last, I hope. This one corrects a bogus format string, and
actually sends the contents of PG_DATESTYLE to the backend. That
means, you can do a setenv PG_DATESTYLE 'iso', and your libpq
will pick that up and tell the backend.
1997-05-07 03:13:50 +00:00
Marc G. Fournier cbaa98835c From: Raymond Toy <toy@rtp.ericsson.se>
Subject: [PATCHES] 970417:  some large object patches


Two patches here, made against 970417.  Both have to do with large
objects:

        1.  lobjfuncs was not initialized in PQconnectdb.  This causes
            failure later if large objects are used.  (Someone already
            caught this error in PQsetdb.)

        2.  Postgres functions lo_import and lo_export sometimes
            produce garbage for the file names because the filename
            strings aren't always terminated by \0.  (VARDATA isn't
            necessarily null terminated.)
1997-04-17 20:39:31 +00:00
Vadim B. Mikheev be0e8f7fb0 connectDB(): setsockopt (..., TCP_NODELAY, ...) added. 1997-04-16 06:29:19 +00:00
Marc G. Fournier cacaaed62b A couple of cleanups from Scott Harrison <Scott_Harrison@next.com> 1997-04-15 19:08:13 +00:00
Marc G. Fournier 920c58df71 From: "Martin J. Laubach" <mjl@CSlab.tuwien.ac.at>
Subject: [HACKERS] libpq variable set patch

  Just a small change, so the automatic variable setting on
connection startup actually works...
1997-04-02 18:26:25 +00:00
Marc G. Fournier 6304e2c273 Here's two more diffs...
The first fixes a warning from gcc about the assignment within the condition.
The extra set of parens should not make a difference, but with -Werror, they
are necessary.

The second fixes an "ln -s" invocation that assumes the current directory is
implicitly the target if not specified.  Not true in all cases, and again, it
should not make a difference except to those implementation that it does.

From: "Michael P. Snyder" <msnyder@hawkeye.huntersmoon.com>
1997-03-25 09:08:06 +00:00
Marc G. Fournier ef56e51cd3 - Renamed the variable names to something shorter, and I hope
nicer. Also, I grabbed my copy of the Informix manual, and
    added a couple of variables that make sense (formats for
    money, time, a language setting, a timezone).

  - New functions SetPGVariable() and GetPGVariable() in tcop/*.
    These don't actually do anything for the moment, but should
    be enough to implement the SET var_name TO var_val in the
    parser?

    SetPGVariable() expects just two strings, the var_name and
    the var_value from above, and is expected to do the right thing.
    Returns TRUE if  everything okay.


From: "Martin J. Laubach" <mjl@wwx.vip.at>
1997-03-25 02:37:21 +00:00
Marc G. Fournier 812a6c2b54 - Move most of the I/O in both libpq and the backend to a set
of common routines in pqcomprim.c (pq communication primitives).
    Not all adapted to it yet, but it's a start.

  - Rewritten some of those routines, to write/read bigger chunks of
    data, precomputing stuff in buffers instead of sending out byte
    by byte.

  - As a consequence, I need to know the endianness of the machine.
    Currently I rely on getting it from machine/endian.h, but this
    may not be available everywhere? (Who the hell thought it was
    a good idea to pass integers to the backend the other way around
    than the normal network byte order? *argl*)

  - Libpq looks in the environment for magic variables, and upon
    establishing a connection to the backend, sends it queries
    of the form "SET var_name TO 'var_value'". This needs a change
    in the backend parser (Mr. Parser, are you there? :)

  - Currently it looks for two Env-Vars, namely PG_DATEFORMAT
    and PG_FLOATFORMAT. What else makes sense? PG_TIMEFORMAT?
    PG_TIMEZONE?

From: "Martin J. Laubach" <mjl@wwx.vip.at>
1997-03-18 20:15:39 +00:00
Marc G. Fournier 3a7c93e7f3 From: Dan McGuirk <mcguirk@indirect.com>
Subject: [HACKERS] password authentication

This patch adds support for plaintext password authentication.  To use
it, you add a line like

host         all         0.0.0.0       0.0.0.0           password  pg_pwd.conf


to your pg_hba.conf, where 'pg_pwd.conf' is the name of a file containing
the usernames and password hashes in the format of the first two fields
of a Unix /etc/passwd file.  (Of course, you can use a specific database
name or IP instead.)

Then, to connect with a password through libpq, you use the PQconnectdb()
function, specifying the "password=" tag in the connect string and also
adding the tag "authtype=password".

I also added a command-line switch '-u' to psql that tells it to prompt
for a username and password and use password authentication.
1997-03-12 21:23:16 +00:00
Marc G. Fournier a5494a2d92 Various patches for nextstep by GregorHoffleit
Replaced NEED_STRDUP by !HAVE_STRDUP
1997-02-13 08:32:20 +00:00
Bryan Henderson f0e7004d29 Make strdup work for Ultrix. Thanks Erik Bertelsen 1996-11-28 03:32:18 +00:00
Bryan Henderson 93f722536f Whoops, redo Ultrix patch so the other ports still compile. 1996-11-26 07:39:11 +00:00
Bryan Henderson 46d58fba33 Make it compile on Ultrix. Thanks Erik Bertelson. 1996-11-26 03:20:35 +00:00
Bryan Henderson f64b840387 Remove most compile-time options, add a few runtime options to make up for it.
In particular, no more compiled-in default for PGDATA or LIBDIR.  Commands
that need them need either invocation options or environment variables.
PGPORT default is hardcoded as 5432, but overrideable with options or
environment variables.
1996-11-14 10:25:54 +00:00
Marc G. Fournier 41b8c2c849 As proposed,
following is the patch to libpq's large object interface that
    removes the requirement to  include  fmgr.h  into  fe-lobj.c.
    The  large object interface now ask's the backend to tell the
    OID's of all the required functions in pg_proc.

From: wieck@sapserv.debis.de (Jan Wieck)
1996-11-11 12:16:57 +00:00
Bruce Momjian aaeef4d17d All external function definitions now have prototypes that are checked. 1996-11-10 03:06:38 +00:00
Bryan Henderson 2e21b7e4bc Add #include <ctype.h> to quiet compiler about missing declaration of isspace(). 1996-11-10 01:46:14 +00:00
Marc G. Fournier 4aa1734f36 Added in PQconnectdb() function
Submitted by: wieck@sapserv.debis.de (Jan Wieck)
1996-11-09 10:39:54 +00:00
Bruce Momjian 7e42f4814d Removed PORTNAME_. Use OS version only. 1996-11-04 04:00:56 +00:00
Marc G. Fournier 4bdf308bdf shared build fails, but the rest compiles...formatting error in the
cc -shared, I believe...
1996-11-03 07:14:32 +00:00
Bryan Henderson aa71f918c3 Fix sigaction again to try for portability. 1996-10-29 21:53:48 +00:00
Bryan Henderson 6cbaa93b82 Change treatment of sigaction structure again to include even more platforms.
Thanks D'Arcy.
1996-10-16 09:41:13 +00:00
Bryan Henderson ec610a7696 Remove 4th element of sigaction structure so it works on more platforms. 1996-10-15 07:16:41 +00:00
Bryan Henderson 329b38eebb Add PGUSER environment variable for client to specify Postgres username. 1996-10-10 08:20:11 +00:00
Marc G. Fournier 0e9f4ceae0 Here's a minor fix that fixes a casting problem:
-Kurt
1996-08-19 13:38:42 +00:00
Marc G. Fournier 77e01653bc Fixes:
When you connect to a database with PQsetdb, as with psql, depending on
how your uninitialized variables are set, you can get a failure with a
"There is no connection to the backend" message.

The fix is to move a call to PQexec() from inside connectDB() to
PQsetdb() after connectDB() returns to PQsetdb().  That way a connection
doesn't have to be already established in order to establish it!


From:  bryanh@giraffe.netgate.net (Bryan Henderson)
1996-08-19 13:25:40 +00:00
Marc G. Fournier 4db7f15b2a Updates to libpq to fix breakage in previous patch...
Submitted by: darcy@druid.druid.com (D'Arcy J.M. Cain)
1996-08-10 00:22:48 +00:00
Marc G. Fournier c4e53a1411 Fixes for:
Here are a few minor fixes to Postgres95.  Mostly I have added const
to some of the char pointers.  There was also a missing header file
and a place where it looks like "==" was used when "=" was meant.
I also changed some variables from Pfin and Pfout tp pfin and pfout
because the latter shadow global variables and that just seems like
an unsafe practice which I like to avoid.

Submitted by:  "D'Arcy J.M. Cain" <darcy@druid.druid.com>
1996-08-06 16:16:50 +00:00
Marc G. Fournier 2206b5819d Alot of "changes" from Dr. George's source tree...
Most of the changes in here look to b epurely cosmetic, and don't
affect anything...

...and some stuff is completely questionable...in that I may have reversed
some of the stuf fwe already had :(
1996-07-23 03:35:14 +00:00
Marc G. Fournier 3704b99522 - libpq calls "fe_getauthname()" two times in "fe-connect.c", but
doesn't free the buffer allocated by this function.

- submitted by: Erich Stamberger <eberger@gewi.kfunigraz.ac.at>
1996-07-19 07:00:56 +00:00
Marc G. Fournier e72ca17f77 fixes for several potential null pointer dereferences
submitted by: Paul "Shag" Walmsley <ccshag@cclabs.missouri.edu>
1996-07-12 04:53:59 +00:00
Marc G. Fournier d31084e9d1 Postgres95 1.01 Distribution - Virgin Sources 1996-07-09 06:22:35 +00:00