Commit Graph

1010 Commits

Author SHA1 Message Date
Bruce Momjian 5c8055e41f Remove last code that assumed xinv/xinx are large object files. 2001-02-09 22:23:47 +00:00
Bruce Momjian cf516c3bb1 I have deleted the include of termios.h in include/port/qnx4.h.
Then I recompiled pgsql and I have compiled a program with ecpg.

I have removed the termios.h, and the ECHO hack.

Thanks
Maurizio
2001-02-09 15:13:49 +00:00
Hiroshi Inoue 5a03b0c393 Change SELECT to not trigger "BEGIN" in not autocommit mode. 2001-02-09 06:03:14 +00:00
Hiroshi Inoue 27ed8ac260 Fix a misuse of 'char *' declaration. 2001-02-08 01:54:29 +00:00
Tom Lane 5add3e8e51 Actually, it looks like DEF_PGPORT belongs over in config.h.win32 for
the Windows build...
2001-02-07 20:00:08 +00:00
Tom Lane b6ffc70dcc Remove broken (and unnecessary) definition of DEF_PGPORT. 2001-02-07 19:30:22 +00:00
Peter Eisentraut d79ab787b8 Only pass the -L* portions of LDFLAGS to the Python build environment.
Other flags can have unpredictable effects when Python uses different
commands to build than we do.
2001-02-07 18:22:10 +00:00
Peter Mount ca5d71cd07 Some updates prior to retrieving a fresh cvs copy:
Tue Feb 06 19:00:00 GMT 2001 peter@retep.org.uk
        - Completed first two TestCase's for the test suite. JUnit is now
          recognised by ant.
2001-02-07 09:13:20 +00:00
Hiroshi Inoue 5d08521fcd Improved version handling introduced by Dave Page.
The driver version is 07.01.0002 now.
1) initialized pg_version by DSN's protocol info
   so that we could always use pg_version info
   once a connection is established (pg_version()
   didn't exist before 6.4). PROTOCOL_XX() macros
   are removed(except from connection.[ch]).
2) provided a few macros to encapsulate connection's
   version info and replaced existent comparison
   stuff by those macros.
3) change SQLTables() so that 7.1 servers could show
   views.


In addtion, the following patch from Dave Page is applied.

  This patch fixes a bug in SQLGetInfo for SQL_DBMS_VER which corrupted the
  driver version string. The driver version number has also been incremented
  to 07.01.0002.

  Regards, Dave. <<odbc.diff>>
2001-02-06 02:21:12 +00:00
Tom Lane 300e28888f Now that I look at it, PQoidValue() ain't quite right either. 2001-02-06 02:02:27 +00:00
Tom Lane 8558054aa4 Repair PQoidStatus() bug reported by darcy@druid.net. 2001-02-06 02:00:09 +00:00
Peter Eisentraut b1f528f86c Check for -lresolv. 2001-02-04 14:09:33 +00:00
Peter Eisentraut 8791d12d9e Pass LDFLAGS along with LIBS to the Python build stuff, especially to pick
up -L options.
2001-02-04 13:21:46 +00:00
Bruce Momjian b60c57da2d Apply patches for QNX from Maurizio 2001-02-02 18:21:59 +00:00
Michael Meskes c9ecf3d1f1 Applied two bug fixes by Christof Petig. 2001-01-31 16:12:34 +00:00
Peter Mount 234599e943 Wed Jan 31 08:46:00 GMT 2001 peter@retep.org.uk
- Some minor additions to Statement to make our own extensions more
          portable.
        - Statement.close() will now call ResultSet.close() rather than just
          dissasociating with it.
2001-01-31 09:23:45 +00:00
Peter Mount 8439a83d84 Tue Jan 30 22:24:00 GMT 2001 peter@retep.org.uk
- Fixed bug where Statement.setMaxRows() was a global setting. Now
          limited to just itself.
        - Changed LargeObject.read(byte[],int,int) to return the actual number
          of bytes read (used to be void).
        - LargeObject now supports InputStream's!
        - PreparedStatement.setBinaryStream() now works!
        - ResultSet.getBinaryStream() now returns an InputStream that doesn't
          copy the blob into memory first!
        - Connection.isClosed() now tests to see if the connection is still alive
          rather than if it thinks it's alive.
2001-01-31 08:26:02 +00:00
Bruce Momjian d7f0b7ef6e Here is an update on the Win32 patch. Modified files are 'config.h.win32'
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
2001-01-27 21:49:59 +00:00
Bruce Momjian 5a832218fd odbc1.diff changes the text on the Protocol Radio buttons on the driver
dialogue from '6.4/6.5' to '6.5+' and removes some C++ comments from
resource.h (which VC++ insists on putting there).

odbc2.diff adds code to query the PostgreSQL version upon connection. This
is then used to determine what values to return for from SQLGetInfo for
SQL_DBMS_VER, SQL_MAX_ROW_SIZE, SQL_MAX_STATEMENT_LEN, SQL_OJ_CAPABILITIES
and SQL_OUTER_JOINS. The version string as returned by SELECT vERSION() (as
a char array) and the major.minor version number (as a flost) have been
added to the ConnectionClass structure.

Dave Page
2001-01-26 22:41:59 +00:00
Tom Lane 7edafafd73 gcc complains about improperly terminated comment. 2001-01-26 22:25:36 +00:00
Michael Meskes 19c4197bd2 Synced gram.y and preproc.y. 2001-01-25 20:35:19 +00:00
Peter Mount f118c36a78 Added an alternative constructor to PGSQLException so that debugging
some more osteric bugs is easier. If only 1 arg is supplied and it's
          of type Exception, then that Exception's stacktrace is now included.

This was done as there's been a report of an unusual bug during connection.
This will make this sort of bug hunting easier from now on.
2001-01-25 09:16:36 +00:00
Bruce Momjian 40203e4f3e Further to the previous ODBC patches I posted today, I found a couple of
problems with char array sizes having set a couple of constants to 0 for
unlimited query length and row length. This additional patch cleans those
problems up by defining a new constant (STD_STATEMENT_LEN) to 65536 and
using that in place of MAX_STATEMENT_LEN.

Another constant (MAX_MESSAGE_LEN) was defined as 2*BLCKSZ, but is now
65536. This is used to define the length of the message buffer in a number
of places and as I understand it (probably not that well!) therefore also
places a limit on the query length. Fixing this properly is beyond my
capabilities but 65536 should hopefully be large enough for most people.

Apologies for being over-enthusiastic and posting 3 patches in one day
rather than 1 better tested one!

Regards,

Dave Page
2001-01-25 03:28:27 +00:00
Bruce Momjian 0e968ee705 > From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 24 January 2001 16:51
> To: Dave Page
> Subject: Re: [PATCHES] ODBC Patch for OJs/Large Querys & Rows
>
>
> > SQL_OJ_LEFT = Left outer joins are supported.
>
> Yes.
<snip>

In addition to my earlier patch, this one adds support for SQLGetInfo
SQL_OJ_CAPABILITIES to the ODBC driver.

Dave Page
2001-01-25 03:27:47 +00:00
Bruce Momjian be1276846e I decided to give this a go after all :-) The attached patch does the
following but it does *not* check whether the user is connected to
PostgreSQL 7.0.x or 7.1 first (as would be required for some of the
features) - the driver doesn't do this at all afaik and it's beyond my
capabilities to implement such checking in code that doesn't look like it
was written by my 1 year old daughter!

1) The driver now reports no maximum query length (SQL_MAX_QUERY_SIZE).
2) The driver now reports no maximum row length (SQL_MAX_ROW_SIZE).
3) The driver now reports that Outer Joins are supported (SQL_OUTER_JOINS),
but still does not report oj capabilities (SQL_OJ_CAPABILITIES).
4) The version number has been incremented to 7.1.0000 in psqlodbc.h *and*
psqlodbc.rc


Regards,

Dave Page
2001-01-25 03:27:05 +00:00
Bruce Momjian 4e45005ffb This patch fixes an arrayindexoutofbounds exception that was just
introduced into the code.  The fix is a fix to
org.postgresql.core.ByteArrayDim1.java.

Barry Lind
2001-01-25 00:02:58 +00:00
Bruce Momjian 26e566446f Attached is a revised patch that removes the static SimpleDateFormat
objects that Thomas pointed out might be a problem.

PPS.  I have included and updated the comments from the original patch
request to reflect the changes made in this revised patch.

> Attached is a set of patches for a couple of bugs dealing with
> timestamps in JDBC.
>
> Bug#1) Incorrect timestamp stored in DB if client timezone different
> than DB.
> The buggy implementation of setTimestamp() in PreparedStatement simply
> used the toString() method of the java.sql.Timestamp object to convert
> to a string to send to the database.  The format of this is yyyy-MM-dd
> hh:mm:ss.SSS which doesn't include any timezone information.  Therefore
> the DB assumes its timezone since none is specified.  That is OK if the
> timezone of the client and server are the same, however if they are
> different the wrong timestamp is received by the server.  For example if
> the client is running in timezone GMT and wants to send the timestamp
> for noon to a server running in PST (GMT-8 hours), then the server will
> receive 2000-01-12 12:00:00.0 and interprete it as 2000-01-12
> 12:00:00-08 which is 2000-01-12 04:00:00 in GMT.  The fix is to send a
> format to the server that includes the timezone offset.  For simplicity
> sake the fix uses a SimpleDateFormat object with its timezone set to GMT
> so that '+00' can be used as the timezone for postgresql.  This is done
> as SimpleDateFormat doesn't support formating timezones in the way
> postgresql expects.
>
> Bug#2) Incorrect handling of partial seconds in getting timestamps from
> the DB
>
> When the SimpleDateFormat object parses a string with a format like
> yyyy-MM-dd hh:mm:ss.SS it expects the fractional seconds to be three
> decimal places (time precision in java is miliseconds = three decimal
> places).  This seems like a bug in java to me, but it is unlikely to be
> fixed anytime soon, so the postgresql code needed modification to
> support the java behaviour.  So for example a string of '2000-01-12
> 12:00:00.12-08' coming from the database was being converted to a
> timestamp object with a value of 2000-01-12 12:00:00.012GMT-08:00.  The
> fix was to check for a '.' in the string and if one is found append on
> an extra zero to the fractional seconds part.
>
>
> I also did some cleanup in ResultSet.getTimestamp().  This method has
> had multiple patches applied some of which resulted in code that was no
> longer needed.  For example the ISO timestamp format that postgresql
> uses specifies the timezone as an offset like '-08'.  Code was added at
> one point to convert the postgresql format to the java one which is
> GMT-08:00, however the old code was left around which did nothing.  So
> there was code that looked for yyyy-MM-dd hh:mm:sszzzzzzzzz and
> yyyy-MM-dd hh:mm:sszzz.  This second format would never be encountered
> because zzz (i.e. -08) would be converted into the former (also note
> that the SimpleDateFormat object treats zzzzzzzzz and zzz the same, the
> number of z's does not matter).
>
>
> There was another problem/fix mentioned on the email lists today by
> mcannon@internet.com which is also fixed by this patch:
>
> Bug#3) Fractional seconds lost when getting timestamp from the DB
> A patch by Jan Thomea handled the case of yyyy-MM-dd hh:mm:sszzzzzzzzz
> but not the fractional seconds version yyyy-MM-dd hh:mm:ss.SSzzzzzzzzz.
> The code is fixed to handle this case as well.

Barry Lind
2001-01-24 23:41:04 +00:00
Bruce Momjian 623bf843d2 Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group. 2001-01-24 19:43:33 +00:00
Peter Mount b869f45d1e Removed the 8k row limit reported by DatabaseMetaData 2001-01-24 09:22:01 +00:00
Bruce Momjian edfca4b98b Subject: Bug in SQLForeignKeys()
Query used for checking foreign key triggers
returns too many results when there're more than one foreign
key in a table. It happens because only table's oid is used to
link between pg_trigger with INSERT check and pg_trigger with
UPDATE/DELETE check.

I think there should be enough to add following conditions
into WHERE clause of that query:
        AND     pt.tgconstrname = pg_trigger.tgconstrname
        AND     pt.tgconstrname = pg_trigger_1.tgconstrname

/Constantin
2001-01-23 20:36:30 +00:00
Michael Meskes d09fc12044 Moved database name handling to libecpg. 2001-01-23 08:15:50 +00:00
Michael Meskes 88ce6a2ba0 Synced preproc.y with gram.y and added missing include file to pgc.l. 2001-01-22 17:05:50 +00:00
Tom Lane 37fd198456 Get rid of sunos4-only strerror() macro, and arrange to use the
implementation in backend/port/strerror.c if configure finds no strerror
in libc, same as we do for snprintf and inet_aton.
2001-01-20 23:07:27 +00:00
Tom Lane 6bb6209bee Make pqexpbuffer a little more robust, per bug report from Heinz Ekker. 2001-01-19 19:39:23 +00:00
Peter Mount be281916f9 Fri Jan 19 08:47:00 GMT 2001 peter@retep.org.uk
- Applied patch submitted by John Schutz <schutz@austin.rr.com> that
          fixed a bug with ANT's SQL functions (not needed for building but nice
          to have fixed).
2001-01-19 08:49:06 +00:00
Peter Mount af8630f26a Forgot to cvs add UpdateableResultSet.java ;-) 2001-01-18 17:38:50 +00:00
Peter Mount 8bc9f0016b Thu Jan 18 17:37:00 GMT 2001 peter@retep.org.uk
- Added new error message into errors.properties "postgresql.notsensitive"
          This is used by jdbc2.ResultSet when a method is called that should
          fetch the current value of a row from the database refreshRow() for
          example.
        - These methods no longer throw the not implemented but the new noupdate
          error. This is in preparation for the Updateable ResultSet support
          which will overide these methods by extending the existing class to
          implement that functionality, but needed to show something other than
          notimplemented:
            moveToCurrentRow()
            moveToInsertRow()
            rowDeleted()
            rowInserted()
            all update*() methods, except those that took the column as a String
            as they were already implemented to convert the String to an int.
        - getFetchDirection() and setFetchDirection() now throws
          "postgresql.notimp" as we only support one direction.
          The CursorResultSet will overide this when its implemented.
        - Created a new class under jdbc2 UpdateableResultSet which extends
          ResultSet and overides the relevent update methods.
          This allows us to implement them easily at a later date.
        - In jdbc2.Connection, the following methods are now implemented:
            createStatement(type,concurrency);
            getTypeMap();
            setTypeMap(Map);
        - The JDBC2 type mapping scheme almost complete, just needs SQLInput &
          SQLOutput to be implemented.
        - Removed some Statement methods that somehow appeared in Connection.
        - In jdbc2.Statement()
            getResultSetConcurrency()
            getResultSetType()
            setResultSetConcurrency()
            setResultSetType()
        - Finally removed the old 6.5.x driver.
2001-01-18 17:37:15 +00:00
Peter Mount 45b5d792af Thu Jan 18 12:24:00 GMT 2001 peter@retep.org.uk
- These methods in org.postgresql.jdbc2.ResultSet are now implemented:
            getBigDecimal(int) ie: without a scale (why did this get missed?)
            getBlob(int)
            getCharacterStream(int)
            getConcurrency()
            getDate(int,Calendar)
            getFetchDirection()
            getFetchSize()
            getTime(int,Calendar)
            getTimestamp(int,Calendar)
            getType()
          NB: Where int represents the column name, the associated version
              taking a String were already implemented by calling the int
              version.
        - These methods no longer throw the not implemented but the new noupdate
          error. This is in preparation for the Updateable ResultSet support
          which will overide these methods by extending the existing class to
          implement that functionality, but needed to show something other than
          notimplemented:
            cancelRowUpdates()
            deleteRow()
        - Added new error message into errors.properties "postgresql.noupdate"
          This is used by jdbc2.ResultSet when an update method is called and
          the ResultSet is not updateable. A new method notUpdateable() has been
          added to that class to throw this exception, keeping the binary size
          down.
        - Added new error message into errors.properties "postgresql.psqlnotimp"
          This is used instead of unimplemented when it's a feature in the
          backend that is preventing this method from being implemented.
        - Removed getKeysetSize() as its not part of the ResultSet API

Thu Jan 18 09:46:00 GMT 2001 peter@retep.org.uk
        - Applied modified patch from Richard Bullington-McGuire
          <rbulling@microstate.com>. I had to modify it as some of the code
          patched now exists in different classes, and some of it actually
          patched obsolete code.

Wed Jan 17 10:19:00 GMT 2001 peter@retep.org.uk
        - Updated Implementation to include both ANT & JBuilder
        - Updated README to reflect the changes since 7.0
	- Created jdbc.jpr file which allows JBuilder to be used to edit the
          source. JBuilder _CAN_NOT_ be used to compile. You must use ANT for
          that. It's only to allow JBuilders syntax checking to improve the
          drivers source. Refer to Implementation for more details
2001-01-18 14:50:15 +00:00
Tom Lane 36839c1927 Restructure backend SIGINT/SIGTERM handling so that 'die' interrupts
are treated more like 'cancel' interrupts: the signal handler sets a
flag that is examined at well-defined spots, rather than trying to cope
with an interrupt that might happen anywhere.  See pghackers discussion
of 1/12/01.
2001-01-14 05:08:17 +00:00
Bruce Momjian 0651a5799d Backed out:
---------------------------------------------------------------------------

Attached is a set of patches for a couple of bugs dealing with
timestamps in JDBC.

Bug#1) Incorrect timestamp stored in DB if client timezone different
than DB.
2001-01-13 18:52:42 +00:00
Bruce Momjian 475c1452b1 Attached is a set of patches for a couple of bugs dealing with
timestamps in JDBC.

Bug#1) Incorrect timestamp stored in DB if client timezone different
than DB.

The buggy implementation of setTimestamp() in PreparedStatement simply
used the toString() method of the java.sql.Timestamp object to convert
to a string to send to the database.  The format of this is yyyy-MM-dd
hh:mm:ss.SSS which doesn't include any timezone information.  Therefore
the DB assumes its timezone since none is specified.  That is OK if the
timezone of the client and server are the same, however if they are
different the wrong timestamp is received by the server.  For example if
the client is running in timezone GMT and wants to send the timestamp
for noon to a server running in PST (GMT-8 hours), then the server will
receive 2000-01-12 12:00:00.0 and interprete it as 2000-01-12
12:00:00-08 which is 2000-01-12 04:00:00 in GMT.  The fix is to send a
format to the server that includes the timezone offset.  For simplicity
sake the fix uses a SimpleDateFormat object with its timezone set to GMT
so that '+00' can be used as the timezone for postgresql.  This is done
as SimpleDateFormat doesn't support formating timezones in the way
postgresql expects.

Bug#2) Incorrect handling of partial seconds in getting timestamps from
the DB

When the SimpleDateFormat object parses a string with a format like
yyyy-MM-dd hh:mm:ss.SS it expects the fractional seconds to be three
decimal places (time precision in java is miliseconds = three decimal
places).  This seems like a bug in java to me, but it is unlikely to be
fixed anytime soon, so the postgresql code needed modification to
support the java behaviour.  So for example a string of '2000-01-12
12:00:00.12-08' coming from the database was being converted to a
timestamp object with a value of 2000-01-12 12:00:00.012GMT-08:00.  The
fix was to check for a '.' in the string and if one is found append on
an extra zero to the fractional seconds part.

Bug#3) Performance problems

In fixing the above two bugs, I noticed some things that could be
improved.  In PreparedStatement.setTimestamp(),
PreparedStatement.setDate(), ResultSet.getTimestamp(), and
ResultSet.getDate() these methods were creating a new SimpleDateFormat
object everytime they were called.  To avoid this unnecessary object
creation overhead, I changed the code to use static variables for
keeping a single instance of the needed formating objects.
Also the code used the + operator for string concatenation.  As everyone
should know this is very inefficient and the use of StringBuffers is
prefered.

I also did some cleanup in ResultSet.getTimestamp().  This method has
had multiple patches applied some of which resulted in code that was no
longer needed.  For example the ISO timestamp format that postgresql
uses specifies the timezone as an offset like '-08'.  Code was added at
one point to convert the postgresql format to the java one which is
GMT-08:00, however the old code was left around which did nothing.  So
there was code that looked for yyyy-MM-dd hh:mm:sszzzzzzzzz and
yyyy-MM-dd hh:mm:sszzz.  This second format would never be encountered
because zzz (i.e. -08) would be converted into the former (also note
that the SimpleDateFormat object treats zzzzzzzzz and zzz the same, the
number of z's does not matter).


There was another problem/fix mentioned on the email lists today by
mcannon@internet.com which is also fixed by this patch:

Bug#4) Fractional seconds lost when getting timestamp from the DB
A patch by Jan Thomea handled the case of yyyy-MM-dd hh:mm:sszzzzzzzzz
but not the fractional seconds version yyyy-MM-dd hh:mm:ss.SSzzzzzzzzz.

The code is fixed to handle this case as well.

Barry Lind
2001-01-13 05:18:05 +00:00
Michael Meskes 353f71a331 Synced preproc.y with gram.y. 2001-01-09 19:46:05 +00:00
Tom Lane 24a4aff68e No need for screen_size to be static. 2001-01-06 17:43:01 +00:00
Tom Lane 2fb6cc9045 Remove not-really-standard implementation of CREATE TABLE's UNDER clause,
and revert documentation to describe the existing INHERITS clause
instead, per recent discussion in pghackers.  Also fix implementation
of SQL_inheritance SET variable: it is not cool to look at this var
during the initial parsing phase, only during parse_analyze().  See
recent bug report concerning misinterpretation of date constants just
after a SET TIMEZONE command.  gram.y really has to be an invariant
transformation of the query string to a raw parsetree; anything that
can vary with time must be done during parse analysis.
2001-01-05 06:34:23 +00:00
Bruce Momjian 6b75942c72 I've found a memory leak in libecpg of PostgreSQL 7.0.3.
The leak is caused by the memory allocation in
src/interfaces/ecpg/lib/execute.c in line 669 which is never freed.
Adding a "free(array_query);" after PQexec in line 671 seems to fix the
leak.

Thorsten Knabe
2001-01-02 22:03:02 +00:00
Tom Lane e41b8a0fdd On further thought, we need a defense against empty PGPORT here too. 2000-12-31 18:23:21 +00:00
Tom Lane 45f92179d9 Ignore PGPORT environment variable if it is an empty string. 2000-12-31 18:15:58 +00:00
Peter Eisentraut 74e2bf95ec Remove C++ comment. 2000-12-30 16:48:49 +00:00
Peter Eisentraut ab432f204a Fix unportable use of '!' in shell commands. 2000-12-30 00:24:09 +00:00
Tom Lane aa44078e21 column and tuple numbers should be int not size_t. 2000-12-29 22:46:37 +00:00