diff options
author | CVS to git conversion script <webmaster@postgresql.org> | 2002-11-04 17:14:30 +0000 |
---|---|---|
committer | CVS to git conversion script <webmaster@postgresql.org> | 2002-11-04 17:14:30 +0000 |
commit | 503b41f6e5db97b79911c140310d9d2abbac0232 (patch) | |
tree | 1a26ca24ac4cf57d0fd3b7cf4c4dd482defdcaeb /src | |
parent | 3f435f9e9950c35fbc5f774d2505951855b30263 (diff) |
This commit was manufactured by cvs2git to create branch 'REL7_3_STABLE'.
Sprout from master 2002-11-04 17:14:29 UTC Tom Lane <tgl@sss.pgh.pa.us> 'Remove extraneous semicolons after routine bodies. These don't bother'
Cherrypick from master 2002-09-04 07:23:04 UTC Bruce Momjian <bruce@momjian.us> 'Brand 7.3. Ready for beta!':
contrib/xml/README
contrib/retep/CHANGELOG
contrib/retep/Implementation
contrib/retep/Makefile
contrib/retep/README
contrib/retep/build.xml
contrib/retep/data/cds.dtd
contrib/retep/data/cds.xml
contrib/retep/uk/org/retep/tools.properties
contrib/retep/uk/org/retep/dtu/DCollection.java
contrib/retep/uk/org/retep/dtu/DConstants.java
contrib/xml/pgxml_dom.source
contrib/retep/uk/org/retep/dtu/DElement.java
contrib/retep/uk/org/retep/dtu/DEnvironment.java
contrib/retep/uk/org/retep/dtu/DModule.java
contrib/retep/uk/org/retep/dtu/DModuleXML.java
contrib/retep/uk/org/retep/dtu/DNode.java
contrib/retep/uk/org/retep/dtu/DProcessor.java
contrib/retep/uk/org/retep/dtu/DTransform.java
contrib/retep/uk/org/retep/tools/Tool.java
contrib/retep/uk/org/retep/util/ExceptionDialog.java
contrib/retep/uk/org/retep/util/Globals.java
contrib/retep/uk/org/retep/util/Logger.java
contrib/retep/uk/org/retep/util/Main.java
contrib/retep/uk/org/retep/util/StandaloneApp.java
contrib/retep/uk/org/retep/util/hba/Editor.java
contrib/retep/uk/org/retep/util/misc/IPAddress.java
contrib/retep/uk/org/retep/util/misc/PropertiesIO.java
contrib/retep/uk/org/retep/util/misc/WStringTokenizer.java
contrib/retep/uk/org/retep/util/models/HBATableModel.java
contrib/retep/uk/org/retep/util/models/PropertiesTableModel.java
contrib/retep/uk/org/retep/util/proped/PropertyEditor.java
contrib/retep/uk/org/retep/xml/core/XMLFactory.java
contrib/retep/uk/org/retep/xml/core/XMLFactoryException.java
contrib/retep/uk/org/retep/xml/jdbc/XMLDatabase.java
contrib/retep/uk/org/retep/xml/jdbc/XMLResultSet.java
contrib/retep/uk/org/retep/xml/parser/TagListener.java
contrib/retep/uk/org/retep/xml/test/XMLExport.java
doc/src/sgml/libpgeasy.sgml
doc/src/sgml/odbc.sgml
contrib/xml/pgxml.source
doc/src/sgml/recovery.sgml
src/test/regress/expected/geometry-bsdi-precision.out
contrib/retep/uk/org/retep/xml/parser/TagHandler.java
doc/src/sgml/version.sgml
doc/src/sgml/y2k.sgml
contrib/retep/retep.jpx
src/interfaces/jdbc/utils/CheckVersion.java
src/interfaces/jdbc/utils/changelog.pl
contrib/retep/uk/org/retep/util/hba/Main.java
contrib/retep/uk/org/retep/util/hba/Record.java
contrib/retep/uk/org/retep/util/proped/Main.java
src/interfaces/jdbc/CHANGELOG
src/interfaces/jdbc/Implementation
src/interfaces/jdbc/utils/buildDriver
src/interfaces/jdbc/jdbc.jpx
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/jdbc/CHANGELOG | 467 | ||||
-rw-r--r-- | src/interfaces/jdbc/Implementation | 199 | ||||
-rw-r--r-- | src/interfaces/jdbc/jdbc.jpx | 31 | ||||
-rw-r--r-- | src/interfaces/jdbc/utils/CheckVersion.java | 74 | ||||
-rwxr-xr-x | src/interfaces/jdbc/utils/buildDriver | 47 | ||||
-rw-r--r-- | src/interfaces/jdbc/utils/changelog.pl | 23 | ||||
-rw-r--r-- | src/test/regress/expected/geometry-bsdi-precision.out | 532 |
7 files changed, 1373 insertions, 0 deletions
diff --git a/src/interfaces/jdbc/CHANGELOG b/src/interfaces/jdbc/CHANGELOG new file mode 100644 index 00000000000..863f8360ba9 --- /dev/null +++ b/src/interfaces/jdbc/CHANGELOG @@ -0,0 +1,467 @@ +Tue Mar 06 12:05:00 GMT 2001 peter@retep.org.uk + - Removed org.postgresql.xa.Test from the JDBC EE driver as it's an old + test class and prevented it from compiling. + +Fri Mar 02 10:00:00 GMT 2001 peter@retep.org.uk + - Fixed build.xml so that PGclob is not built in the JDBC1.2 driver + + +Fri Feb 17 18:25:00 GMT 2001 peter@retep.org.uk + - Removed the last deprecation warnings from the Java2 driver. Now only + the old examples give deprecation warnings. + - Added a new class into core that (JDK1.3+) ensures all connections are + closed when the VM terminates. + +Fri Feb 17 15:11:00 GMT 2001 peter@retep.org.uk + - Reduced the object overhead in PreparedStatement by reusing the same + StringBuffer object throughout. Similarly SimpleDateStamp's are alse + reused in a thread save manner. + - Implemented in PreparedStatement: setNull(), setDate/Time/Timestamp + using Calendar, setBlob(), setCharacterStream() + - Clob's are now implemented in ResultSet & PreparedStatement! + - Implemented a lot of DatabaseMetaData & ResultSetMetaData methods. + We have about 18 unimplemented methods left in JDBC2 at the current + time. + +Web Feb 14 17:29:00 GMT 2001 peter@retep.org.uk + - Fixed bug in LargeObject & BlobOutputStream where the stream's output + was not flushed when either the stream or the blob were closed. + - Fixed PreparedStatement.setBinaryStream() where it ignored the length + +Tue Feb 13 16:33:00 GMT 2001 peter@retep.org.uk + - More TestCases implemented. Refined the test suite api's. + - Removed need for SimpleDateFormat in ResultSet.getDate() improving + performance. + - Rewrote ResultSet.getTime() so that it uses JDK api's better. + +Tue Feb 13 10:25:00 GMT 2001 peter@retep.org.uk + - Added MiscTest to hold reported problems from users. + - Fixed PGMoney. + - JBuilder4/JDBCExplorer now works with Money fields. Patched Field & + ResultSet (lots of methods) for this one. Also changed cash/money to + return type DOUBLE not DECIMAL. This broke JBuilder as zero scale + BigDecimal's can't have decimal places! + - When a Statement is reused, the previous ResultSet is now closed. + - Removed deprecated call in ResultSet.getTime() + +Thu Feb 08 18:53:00 GMT 2001 peter@retep.org.uk + - Changed a couple of settings in DatabaseMetaData where 7.1 now + supports those features + - Implemented the DatabaseMetaData TestCase. + +Wed Feb 07 18:06:00 GMT 2001 peter@retep.org.uk + - Added comment to Connection.isClosed() explaining why we deviate from + the JDBC2 specification. + - Fixed bug where the Isolation Level is lost while in autocommit mode. + - Fixed bug where several calls to getTransactionIsolationLevel() + returned the first call's result. + +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. + +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. + +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. +Thu Jan 25 09:11:00 GMT 2001 peter@retep.org.uk + - 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. + +Wed Jan 24 09:18:00 GMT 2001 peter@retep.org.uk + - Removed the 8k limit by setting it to 64k + +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). + +Thu Jan 18 17:30: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. + +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 + +Wed Dec 20 16:19:00 GMT 2000 peter@retep.org.uk + - Finished build.xml and updated Driver.java.in and buildDriver to + match how Makefile and ANT operate. + +Tue Dec 19 17:30:00 GMT 2000 peter@retep.org.uk + - Finally created ant build.xml file + +Mon Nov 20 08:12:00 GMT 2000 peter@retep.org.uk + - Encoding patch to Connection by wrobell@posexperts.com.pl + +Tue Oct 17 15:35:00 BST 2000 petermount@maidstone.gov.uk + - Changed getTimestamp() again. This time Michael Stephenson's + <mstephenson@tirin.openworld.co.uk> solution looked far better + than the original solution put in June. + +Tue Oct 10 13:12:00 BST 2000 peter@retep.org.uk + - DatabaseMetaData.supportsAlterTableWithDropColumn() as psql doesn't + support dropping of individual columns + - Merged in some last patches. Only 1 left, which may not be compatible + with jdbc1 + - Merged in my old retepsql project. Makefile now includes it. + +Mon Oct 02 12:30:00 BST 2000 peter@retep.org.uk + - Merged in byte[] array allocation changes submitted by Gunnar R|nning + <gunnar@candleweb.no> + +Mon Sep 25 14:22:00 BST 2000 peter@retep.org.uk + - Removed the DriverClass kludge. Now the org.postgresql.Driver class + is compiled from a template file, and now has both the connection + class (ie jdbc1/jdbc2) and the current version's from Makefile.global + +Thu Jul 20 16:30:00 BST 2000 petermount@it.maidstone.gov.uk + - Fixed DatabaseMetaData.getTableTypes() + +Tue Jun 06 12:00:00 BST 2000 petermount@it.maidstone.gov.uk + - Added org/postgresql/DriverClass.java to the list of files removed + by make clean (it's dynamically built) + - Fixed Statement, so that the update count is valid when an SQL + DELETE operation is done. + - While fixing the update count, made it easier to get the OID of + the last insert as well. Example is in example/basic.java + +Tue Jun 06 08:37:00 BST 2000 petermount@it.maidstone.gov.uk + - Removed a hardwired 8K limit on query strings + - Added some missing org.'s in Connection that prevented + the use of the geometric types. + +Thu Jun 01 07:26:00 BST 2000 petermount@it.maidstone.gov.uk + - Removed timezone in getTimestamp() methods in ResultSet. + +Mon May 15 22:30:00 BST 2000 peter@retep.org.uk + - Fixed the message Makefile produces after compiling. It still said + about the old Driver class, not the new package. Spotted by + Joseph Shraibman <jks@p1.selectacast.net> + +Thu May 04 11:38:00 BST 2000 petermount@it.maidstone.gov.uk + - Corrected incorrect date in CHANGELOG + - Fixed the ImageViewer example + +Wed May 03 16:47:00 BST 2000 petermount@it.maidstone.gov.uk + - Fixed the Makefile so that postgresql.jar is built everytime + the jdbc1 or jdbc2 rules are called. + - Fixed the threadsafe example. It had problems with autocommit + +Wed May 03 14:32:00 BST 2000 petermount@it.maidstone.gov.uk + - Rewrote the README file (the old one was 18 months old!) + - Added @deprecated tags to org.postgresql.jdbc2.ResultSet + to clear some warnings issued during compilation. + +Wed Apr 12 22:14:00 BST 2000 peter@retep.org.uk + - Implemented the JDBC2 Blob interface, and ResultSet.getBlob(). + +Wed Apr 12 20:20:00 BST 2000 peter@retep.org.uk + - Fixed bug in ResultSet.absolute(). Negative rows are now supported. + - Implemented ResultSet.relative(), afterLast(). + +Tue Feb 1 21:40:00 GMT 2000 peter@retep.org.uk + - Finally imported the contributed javax extensions by Assaf Arkin + arkin@exoffice.com + +Mon Jan 24 21:00:00 GMT 2000 peter@retep.org.uk + - Finally introduced the 7.0 additions to the core CVS repository. + - All source files are now under the org.postgresql package (previously + they were under postgresql). The package lines now changed + accordingly. + - The Makefile was rewritten so it should now work on machines that + can't handle the $( ) syntax. + - Dutch translation by Arnout Kuiper (ajkuiper@wxs.nl) + +Mon Sep 13 23:56:00 BST 1999 peter@retep.org.uk + - PG_Stream.SendChar() optimised, increased default buffer size of + output stream to 8k, and introduced an 8k buffer on the input stream + Sverre H Huseby <sverrehu@online.no> + - Added a finalize() method to Connection class in both drivers so that + the connection to the backend is really closed. + - Due to many JVM's not returning a meaningful value for java.version + the decision for building the JDBC1.2 or JDBC2 driver is now a + compile time option. + - Replaced $$(cmd...) with `cmd...` in the Makefile. This should allow + the driver to compile when using shells other than Bash. + +Thu Sep 9 01:18:39 MEST 1999 jens@jens.de + - fixed bug in handling of DECIMAL type + +Wed Aug 4 00:25:18 CEST 1999 jens@jens.de + - updated ResultSetMetaData.getColumnDisplaySize() to return + the actual display size + - updated driver to use postgresql FE/BE-protocol version 2 + +Mon Aug 2 03:29:35 CEST 1999 jens@jens.de + - fixed bug in DatabaseMetaData.getPrimaryKeys() + +Sun Aug 1 18:05:42 CEST 1999 jens@jens.de + - added support for getTransactionIsolation and setTransactionIsolation + +Sun Jun 27 12:00:00 BST 1999 + - Fixed typo in postgresql.Driver that prevented compilation + - Implemented getTimestamp() fix submitted by Philipp Matthias Hahn + <pmhahn@titan.lahn.de> + - Cleaned up some comments in Connection + +Wed Jun 23 06:50:00 BST 1999 + - Fixed error in errors.properties where the arguments are 0 based not + 1 based + - Fixed bug in postgresql.Driver where exception is thrown, then + intercepted rather than being passed to the calling application. + - Removed the file postgresql/CallableStatement, as it's not used and + really exists in the jdbc1 & jdbc2 sub packages only. + +Wed May 19 00:20:00 BST 1999 + - Internationalisation now done. Surprising that there's 68 error + messages in the driver ;-) + +Tue May 18 07:00:00 BST 1999 + - Set the ImageViewer application to use transactions + +Tue May 18 00:00:00 BST 1999 + - Just after committing, I realised why internationalisation isn't + working. This is now fixed (in the Makefile). + +Mon May 17 23:40:00 BST 1999 + - PG_Stream.close() now attempts to send the close connection message + to the backend before closing the streams + - Added batch support in the JDBC2, supplied by Yutaka Tanida + <yutaka@marin.or.jp> + - Removed the old datestyle code. Now the driver uses only ISO. + - Removed some files in the postgresql directory still in CVS that were + moved since 6.4.x (DatabaseMetaData.java PreparedStatement.java + ResultSetMetaData.java Statement.java) + - Internationalisation of the error messages is partially implemented, + however it's not enabled as it only works when the jar file is + _not_ used, and work needs to be done. + +Sun Apr 11 17:00:00 BST 1999 + - getUpdateCount() now returns the actual update count (before it + simply returned 1 for everything). + - added some updates to example.basic so it would test the new update + count code. + - corrected typo in a comment in Statement.java + +Mon Jan 25 19:45:00 GMT 1999 + - created subfolders example/corba and example/corba/idl to hold the + new example showing how to hook CORBA and PostgreSQL via JDBC + - implemented some JDBC2 methods curtesy of Joachim.Gabler@t-online.de + +Sat Jan 23 10:30:00 GMT 1999 + - Changed imports in postgresql.jdbc1.ResultSetMetaData as for some + reason it didn't want to compile under jdk1.1.6 + +Tue Dec 29 15:45:00 GMT 1998 + - Refreshed the README (which was way out of date) + +Tue Dec 29 15:45:00 GMT 1998 + - Finished adding the additional methods into the JDBC2 driver. + - Had to add some explicit package references for the JDK1.2 Javac to + cope with the driver + +Tue Dec 29 12:40:00 GMT 1998 + - Fixed package imports and some references to java.sql.ResultSet in + various files. Compiled and tested the JDBC1 driver. + +Mon Dec 28 19:01:37 GMT 1998 + - created a new package postgresql.jdbc2 which will contain the JDBC 2 + specific classes. A similar new package (postgresql.jdbc1) has been + created to hold the JDBC 1 specific classes. + - modified Makefile to allow compilation of the JDBC 1 & 2 drivers, + with the possibility of building a dual-spec driver. + - changed the version number in postgresql.Driver to 6.5 + - modified postgresql.Driver class to initiate the correct driver when + used under a 1.1 or 1.2+ JVM. + - postgresql.Connection and postgresql.jdbc2.Connection now extends the + new class postgresql.ConnectionStub, which allows us to dynamically + open the JDBC1 or JDBC2 drivers. + - enabled compilation of the driver under Win32 when using the Make + from the CygWin package (Cygnus B20.1 was used). + - To make future development easier (now we have 2 specifications to + work with) the following classes have moved from the postgresql to + the postgresql.jdbc1 package: + CallableStatement Connection + DatabaseMetaData PreparedStatement + ResultSet ResultSetMetaData + Statement + Some of these classes have common code that is not dependent on + either JDBC specification. These common code are still in the + postgresql package. + Ie: postgresql.jdbc1.Connection extends postgresql.Connection + and postgresql.jdbc2.Connection extends postgresql.Connection + +Web Oct 7 22:00:00 BST 1998 + - removed syncronised from Connection.ExecSQL(). See next entry. + - added new syncronised locking in the Connection.ExecSQL() and + FastPath.fastpath() methods. They now lock against the PG_Steam + object for the connection, which now provides full Thread Safety. + - Reposted ChangeLog as it's missing from CVS. + +Modifications done since 6.3.2 was released and Sun Aug 30 11:33:06 BST 1998 + + - Fixed PreparedStatement.setObject as it didn't handle shorts + - ResultSet.getDate() now handles null dates (returns null ratrher + than a NullPointerException) + - ResultSetMetaData.getPrecision() new returns 0 for VARCHAR + - Field now caches the typename->oid in a Hashtable to speed things + up. It removes the need for some unnecessary queries to the backend. + - PreparedStatement.toString() now returns the SQL statement that it + will send to the backend. Before it did nothing. + - DatabaseMetaData.getTypeInfo() now does something. + - Connection now throws an exception if either of the user or password + properties are missing, as they are required for JDBC to work. + This occasionally occurs when the client uses the properties version + of getConnection(), and is a common question on the email lists. + +Sun Aug 30 11:33:06 BST 1998 + + - Created ChangeLog file, and entered stuff done since 6.3.2 and today + - Change version number to 6.4 in Driver.java + - Added fix to DatabaseMetaData.getTables() submitted by + Stefan Andreasen <stefan@linux.kapow.dk> + - Added fix to DatabaseMetaData.getColumns() to handle patterns + submitted by Stefan Andreasen <stefan@linux.kapow.dk> + - Set TcpNoDelay on the connection, as this gives us a 10x speed + improvement on FreeBSD (caused by a bug in their TCP Stack). They + should fix the bug before 6.4 is released, but will keep this + in here unless it causes more problems. + Submitted by Jason Venner <jason@idiom.com> + - Removed a duplicate definition of fieldCache + - Added a more meaningful message when the connection is refused. It + now says: + Connection refused. Check that the hostname and port is + correct, and that the postmaster is running with the -i flag, + which enables TCP/IP networking. + - Removed kludge in PreparedStatement.setDate() that acted as a + temporary fix to a bug in SimpleDateFormat, as it broke date + handling in JDK 1.1.6. + - Modified PG_Stream and Connection, so that outbound data is now + buffered. This should give us a speed improvement, and reduce the + ammount of network packets generated. + - Removed duplicate code and optimised PG_Stream. + - PG_Stream now returns a more meaningful message when the connection + is broken by the backend. It now returns: + The backend has broken the connection. Possibly the action you + have attempted has caused it to close. + - Removed obsolete code from Connection. + - The error message returned when the authentication scheme is unknown + has been extended. It now reads: + Authentication type ### not supported. Check that you have + configured the pg_hba.conf file to include the client's IP + address or Subnet, and is using a supported authentication + scheme. + - Connection.getMetaData() now caches the instance returned, so + multiple calls will return the same instance. + - Created a test application that tests the DatabaseMetaData and + ResultSetMetaData classes. + - Replaced getString(#).getBytes() with getBytes(#) which should speed + things up, and reduce memory useage. + - Optimised DatabaseMetaData.getProcedures(), and implemented patterns + - Fixed NullPointerExceptions thrown when a field is null (Internal + to the driver, not caused by results from the backend. + DatabaseMetaData.getProcedures() is an example of a method that + causes this): + - ResultSetMetaData.getColumnName() now returns field# where + # is the column name. + - ResultSet.getObject() fixed + - Fixed bug in psql example that was affected by null fields + - DatabaseMetaData.getTables() + - DatabaseMetaData.getPrimaryKeys() ran a query with an ambiguous field + fixed. + - getTypeInfo() optimised to increase speed and reduce memory useage + - ResultSetMetaData.isCurrency() optimised and is now smaller. + - Removed unnecessary code fromResultSetMetaData.getCatalogName() + and getSchemaName(). + - Created new class postgresql.util.PGmoney to map the money type + - Created new class postgresql.geometric.PGline to map the line type + diff --git a/src/interfaces/jdbc/Implementation b/src/interfaces/jdbc/Implementation new file mode 100644 index 00000000000..ecfc626d9d6 --- /dev/null +++ b/src/interfaces/jdbc/Implementation @@ -0,0 +1,199 @@ +This short document is provided to help programmers through the internals of +the PostgreSQL JDBC driver. + +Last update: January 17 2001 peter@retep.org.uk + +build.xml +--------- + +As of 7.1, we now use the ANT build tool to build the driver. ANT is part of +the Apache/Jakarta project, and provides far superior build capabilities. You +can find ANT from http://jakarta.apache.org/ant/index.html and being pure java +it will run on any java platform. + +So far I've tested it under JDK1.2.x & JDK1.3 (both Linux & NT) but not yet with +JDK1.1.8. Because of the latter the Makefile still works for now, but should be +gone for 7.2. + +Anyhow, to build, simply type ant and the .jar file will be created and put into +the jars directory. + +Tip: If you run ant from the sources root directory (ie: where the configure +script is located) you will find another build.xml file. It is advised to run +ant from that directory as it will then compile some auxilary Java/JDBC +utilities that are located under the /contrib/retep directory. + +Makefile +-------- + +Prior to 7.1, all compilation must be done by using Make. This is because there +are three versions of the driver, one for JDBC1 (for JDK 1.1.x) and the others +for JDBC2 (for JDK 1.2 or later, one standard and one enterprise). + +As of 7.1, ANT is the build tool of choice. Just compare Makefile and build.xml +to see why! Make just isn't suited to Java. + +Building with just the JDK +-------------------------- + +This is not advised, simply because you have to make sure you include the +correct classes, and the fact that org.postgresql.Driver is built on the fly. +Also, javac won't pick up all the classes because some (org.postgresql.geometric +for example) are loaded dynamically. + +org/postgresql/Driver.java.in +----------------------------- + +Because there are three versions of the driver, the org.postgresql.Driver class +is built dynamically. To build correctly ANT copies the Driver.java.in file to +Driver.java replacing certain values according to the required driver. + +The replaced values are of the format %VALUE%, ie: %MAJORVERSION% is replaced +with 7 in the 7.1 version of the driver. + +postgresql.jar +-------------- + +This jar file is produced by ANT, and contains the driver for your JDK platform. + +If you downloaded a precompiled binary from the web, you may find that the +jar file will be named differently. These are identical to this file but are +named according to the backend and jdk versions. + +The naming convention is of the form: jdbc-#.#-#.##.jar + +ie: for 7.1 + jdbc-7.1-1.1.jar JDBC Driver for JDK1.1.8 + jdbc-7.1-1.2.jar JDBC Driver for JDK1.2 & JDK1.3 + jdbc-7.1-1.2ent.jar JDBC Driver for JDK1.2 & JDK1.3 Enterprise Editions + +If in the future there are any 1.3 specific classes then there will be two new +jar files. + +Note: All the precompiled binaries are built under Linux. + +jdbc.jpx +-------- + +This is a JBuilder4 project file. It's here to allow JBuilder to be used to +develop the driver. Mainly for it's Editor's features like syntax checking and +auto-completion etc. + +IMPORTANT: You CAN NOT build the driver from within JBuilder. You must use ANT. + This is because of the three versions of the JDK. If you try to use + JBuilder, it will try to build everything, and it will just not work. + +Importing packages +------------------ + +In user code, you may have to import one or more packages, if and only if you +are using the non jdbc extensions (like FastPath, or LargeObject). + +DO NOT import the postgresql, postgresql.jdbc1 or postgresql.jdbc2 packages! + +Internally, some classes will import the packages when there is a link between +them and the other packages. However, the above rule still applies. It's there +because Javac becomes confused between the different places that similar class +names are present. + +However, there are places where they need to refer to classes in the postgresql +package. In this case, import the individual classes, and not the entire +package. + +ie: import postgresql.Field + + NOT import postgresql.* + +Package Layout +-------------- + +The driver is split into several packages: + +org.postgresql core classes that can be accessed by user code +org.postgresql.core core classes not normally used externally +org.postgresql.jdbc1 classes used only in implementing JDBC 1 +org.postgresql.jdbc2 classes used only in implementing JDBC 2 +org.postgresql.fastpath FastPath to backend functions +org.postgresql.geometric 2D Geometric types mapped to Java Objects +org.postgresql.largeobject Low level Large Object access +org.postgresql.util Utility classes + + +Package org.postgresql +------------------ + +This package holds the core classes. + +Driver registers the driver when it's loaded, and determines which + Connection class (in jdbc1 or jdbc2 packages) to use when + connecting to a database. + +Field Used internally to represent a Field +PG_Stream Used internally to manage the network stream. +PostgresqlDataSource + Exists in the Java2 Enterprise edition driver only and is the + enterprise equivalent to Driver + + These classes contains common code that is not dependent to the + two JDBC specifications. + +Connection Common code used in Connections, mainly Network Protocol stuff. +ResultSet Common code used in ResultSet's + +Package org.postgresql.core +----------------------- + +New in 7.1, this is where core classes (common to all versions) will exist. Any +new class that would have gone into org.postgresql must go in here instead. + +BytePoolDim1 Handles a pool of byte[] arrays. +BytePoolDim2 Handles a pool of byte[][] arrays +MemoryPool Interface for managing MemoryPools. Not used (yet). +ObjectPool Interface for an Object Pool +SimpleObjectPool Class that implements ObjectPool and used by BytePoolDim# +Encoding Character encoding logic, mainly for Connection and PG_Stream. + +Package org.postgresql.fastpath +--------------------------- + +Fastpath Handles executing a function on the PostgreSQL Backend +FastpathArg Defines an argument for a function call + +Package org.postgresql.geometric +---------------------------- + +PGbox Maps to postgresql type box +PGcircle Maps to postgresql type circle +PGline Maps to postgresql type line +PGlseg Maps to postgresql type lseg +PGpath Maps to postgresql type path +PGpoint Maps to postgresql type point +PGpolygon Maps to postgresql type polygon + +Package org.postgresql.jdbc1 +------------------------ + +The classes in this package handle the JDBC 1 Specification, for JDK 1.1.x +All interfaces in the java.sql package are present here. + +Package org.postgresql.jdbc2 +------------------------ + +The classes in this package handle the JDBC 2 Specification, for JDK 1.2 +All interfaces in the java.sql, and javax.sql packages are present here. + +Package org.postgresql.largeobject +------------------------------ + +LargeObject Represents an open LargeObject +LargeObjectManager Handles the opening and deleting of LargeObjects + +Package org.postgresql.util +----------------------- + +PGmoney Maps to postgresql type money +PGobject Used to represent postgresql types that have no Java equivalent +PGtokenizer Helper class for the geometric types +Serialize Used to serialise Java objects into tabes, rather than Blobs +UnixCrypt Used to handle crypt authentication + diff --git a/src/interfaces/jdbc/jdbc.jpx b/src/interfaces/jdbc/jdbc.jpx new file mode 100644 index 00000000000..8c17267ca1b --- /dev/null +++ b/src/interfaces/jdbc/jdbc.jpx @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--JBuilder XML Project--> +<project> + <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner" /> + <property category="runtime.0" name="jsprunner.docbase" value="." /> + <property category="runtime.0" name="jsprunner.jspfile" value="E%|/docs/java/xml/example6" /> + <property category="sys" name="BackupPath" value="bak" /> + <property category="sys" name="CheckStable" value="1" /> + <property category="sys" name="Company" value="" /> + <property category="sys" name="Copyright" value="Copyright (c) 2001" /> + <property category="sys" name="DefaultPackage" value="org.postgresql.core" /> + <property category="sys" name="Description" value="" /> + <property category="sys" name="DocPath" value="doc" /> + <property category="sys" name="ExcludeClassEnabled" value="0" /> + <property category="sys" name="JDK" value="java 1.3.0-C" /> + <property category="sys" name="LastTag" value="0" /> + <property category="sys" name="Libraries" value="JUnit" /> + <property category="sys" name="MakeStable" value="0" /> + <property category="sys" name="OutPath" value="build" /> + <property category="sys" name="SourcePath" value="." /> + <property category="sys" name="Title" value="" /> + <property category="sys" name="Version" value="1.0" /> + <property category="sys" name="WorkingDirectory" value="." /> + <node type="Package" name="org.postgresql.core" /> + <file path="build.xml" /> + <file path="CHANGELOG" /> + <file path="Implementation" /> + <file path="README" /> + <file path="org/postgresql/jdbc2/UpdateableResultSet.java" /> +</project> diff --git a/src/interfaces/jdbc/utils/CheckVersion.java b/src/interfaces/jdbc/utils/CheckVersion.java new file mode 100644 index 00000000000..a2438cd4f9f --- /dev/null +++ b/src/interfaces/jdbc/utils/CheckVersion.java @@ -0,0 +1,74 @@ +package utils; + +/* + * This little app checks to see what version of JVM is being used. + * It does this by checking first the java.vm.version property, and + * if that fails, it looks for certain classes that should be present. + */ +public class CheckVersion +{ + /* + * Check for the existence of a class by attempting to load it + */ + public static boolean checkClass(String c) + { + try + { + Class.forName(c); + } + catch (Exception e) + { + return false; + } + return true; + } + + /* + * This first checks java.vm.version for 1.1, 1.2 or 1.3. + * + * It writes jdbc1 to stdout for the 1.1.x VM. + * + * For 1.2 or 1.3, it checks for the existence of the javax.sql.DataSource + * interface, and if found writes enterprise to stdout. If the interface + * is not found, it writes jdbc2 to stdout. + * + * PS: It also looks for the existence of java.lang.Byte which appeared in + * JDK1.1.0 incase java.vm.version is not heeded by some JVM's. + * + * If it can't work it out, it writes huho to stdout. + * + * The make file uses the written results to determine which rule to run. + * + * Bugs: This needs thorough testing. + */ + public static void main(String args[]) + { + String vmversion = System.getProperty("java.vm.version"); + + System.out.println("postgresql.jdbc=" + System.getProperty("postgresql.jdbc")); + + // We are running a 1.1 JVM + if (vmversion.startsWith("1.1")) + { + System.out.println("jdbc1"); + //System.exit(0); + } + else + // We are running a 1.2 or 1.3 JVM + if (vmversion.startsWith("1.2") || + vmversion.startsWith("1.3") || + checkClass("java.lang.Byte") + ) + { + + // Check to see if we have the standard extensions. If so, then + // we want the enterprise edition, otherwise the jdbc2 driver. + if (checkClass("javax.sql.DataSource")) + System.out.println("enterprise"); + else + System.out.println("jdbc2"); + //System.exit(0); + } + System.setProperty("postgresql.jdbc", "yoyo"); + } +} diff --git a/src/interfaces/jdbc/utils/buildDriver b/src/interfaces/jdbc/utils/buildDriver new file mode 100755 index 00000000000..8cca1d9c36d --- /dev/null +++ b/src/interfaces/jdbc/utils/buildDriver @@ -0,0 +1,47 @@ +#!/bin/sh +# +# $Id: buildDriver,v 1.2 2000/12/20 16:22:49 peter Exp $ +# +# This script generates the org/postgresql/Driver.java file from the template +# org/postgresql/Driver.java.in +# +# We do this because we need to include the version number from Makefile.global +# and some other goodies. +# +# This used to be in Makefile, but as it's now done three times, it's better +# to have it as a separate script. +# +# If you have any problems, please let us know ;-) +# +# Syntax: buildDriver version class +# +# Where: +# version The version string from Makefile.global +# class The class implementing java.sql.Connection +# edition The driver edition being built +# source The file to build. We assume that ${source}.in exists +# + +VERSION=$1 +CLASS=$2 +EDITION=$3 +SOURCE=$4 + +#--------------------------------------------------------------------------- +# Extract the version. This will work until version x.9 (and assuming we don't +# have 7.10 etc). We only handle 1 digit for MINORVERSION to handle things like +# 7.1devel etc +# +MAJORVERSION=`echo $VERSION | cut -f1 -d'.'` +MINORVERSION=`echo $VERSION | cut -f2 -d'.' | cut -c1` + +#--------------------------------------------------------------------------- +# Now finally build the driver +sed \ + -e "s/@JDBCCONNECTCLASS@/$CLASS/g" \ + -e "s/@VERSION@/$VERSION $EDITION/g" \ + -e "s/@MAJORVERSION@/$MAJORVERSION/g" \ + -e "s/@MINORVERSION@/$MINORVERSION/g" \ + <${SOURCE}.in \ + >$SOURCE +#--------------------------------------------------------------------------- diff --git a/src/interfaces/jdbc/utils/changelog.pl b/src/interfaces/jdbc/utils/changelog.pl new file mode 100644 index 00000000000..3cba15aa91d --- /dev/null +++ b/src/interfaces/jdbc/utils/changelog.pl @@ -0,0 +1,23 @@ +#!/bin/perl + +while(<>) { + chomp(); + s/\t+/ /g; + if(substr($_,0,3) eq ' - ') { + print "<ul>" if !$inlist; + $inlist=1; + print "<li>".substr($_,3)."\n"; + } else { + if($_ eq "" || $_ eq " ") { + print "</ul>" if $inlist; + $inlist=0; + print "<br>\n"; + } elsif(substr($_,0,1) eq " ") { + print $_; + } else { + print "</ul>" if $inlist; + $inlist=0; + print "<h4>".$_."</h4>\n"; + } + } +} diff --git a/src/test/regress/expected/geometry-bsdi-precision.out b/src/test/regress/expected/geometry-bsdi-precision.out new file mode 100644 index 00000000000..7892b5dceda --- /dev/null +++ b/src/test/regress/expected/geometry-bsdi-precision.out @@ -0,0 +1,532 @@ +-- +-- GEOMETRY +-- +-- +-- Points +-- +SELECT '' AS four, center(f1) AS center + FROM BOX_TBL; + four | center +------+--------- + | (1,1) + | (2,2) + | (2.5,3) + | (3,3) +(4 rows) + +SELECT '' AS four, (@@ f1) AS center + FROM BOX_TBL; + four | center +------+--------- + | (1,1) + | (2,2) + | (2.5,3) + | (3,3) +(4 rows) + +SELECT '' AS six, point(f1) AS center + FROM CIRCLE_TBL; + six | center +-----+----------- + | (0,0) + | (1,2) + | (1,3) + | (1,2) + | (100,200) + | (100,0) +(6 rows) + +SELECT '' AS six, (@@ f1) AS center + FROM CIRCLE_TBL; + six | center +-----+----------- + | (0,0) + | (1,2) + | (1,3) + | (1,2) + | (100,200) + | (100,0) +(6 rows) + +SELECT '' AS two, (@@ f1) AS center + FROM POLYGON_TBL + WHERE (# f1) > 2; + two | center +-----+------------------------------------- + | (1.33333333333333,1.33333333333333) + | (2.33333333333333,1.33333333333333) +(2 rows) + +-- "is horizontal" function +SELECT '' AS two, p1.f1 + FROM POINT_TBL p1 + WHERE ishorizontal(p1.f1, point '(0,0)'); + two | f1 +-----+--------- + | (0,0) + | (-10,0) +(2 rows) + +-- "is horizontal" operator +SELECT '' AS two, p1.f1 + FROM POINT_TBL p1 + WHERE p1.f1 ?- point '(0,0)'; + two | f1 +-----+--------- + | (0,0) + | (-10,0) +(2 rows) + +-- "is vertical" function +SELECT '' AS one, p1.f1 + FROM POINT_TBL p1 + WHERE isvertical(p1.f1, point '(5.1,34.5)'); + one | f1 +-----+------------ + | (5.1,34.5) +(1 row) + +-- "is vertical" operator +SELECT '' AS one, p1.f1 + FROM POINT_TBL p1 + WHERE p1.f1 ?| point '(5.1,34.5)'; + one | f1 +-----+------------ + | (5.1,34.5) +(1 row) + +-- +-- Line segments +-- +-- intersection +SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection + FROM LSEG_TBL l, POINT_TBL p; +ERROR: Unable to identify an operator '#' for types 'lseg' and 'point' + You will have to retype this query using an explicit cast +-- closest point +SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest + FROM LSEG_TBL l, POINT_TBL p; + thirty | f1 | s | closest +--------+------------+-------------------------------+--------------------------------------- + | (0,0) | [(1,2),(3,4)] | (1,2) + | (-10,0) | [(1,2),(3,4)] | (1,2) + | (-3,4) | [(1,2),(3,4)] | (1,2) + | (5.1,34.5) | [(1,2),(3,4)] | (3,4) + | (-5,-12) | [(1,2),(3,4)] | (1,2) + | (10,10) | [(1,2),(3,4)] | (3,4) + | (0,0) | [(0,0),(6,6)] | (-0,0) + | (-10,0) | [(0,0),(6,6)] | (0,0) + | (-3,4) | [(0,0),(6,6)] | (0.5,0.5) + | (5.1,34.5) | [(0,0),(6,6)] | (6,6) + | (-5,-12) | [(0,0),(6,6)] | (0,0) + | (10,10) | [(0,0),(6,6)] | (6,6) + | (0,0) | [(10,-10),(-3,-4)] | (-2.04878048780488,-4.4390243902439) + | (-10,0) | [(10,-10),(-3,-4)] | (-3,-4) + | (-3,4) | [(10,-10),(-3,-4)] | (-3,-4) + | (5.1,34.5) | [(10,-10),(-3,-4)] | (-3,-4) + | (-5,-12) | [(10,-10),(-3,-4)] | (-1.60487804878049,-4.64390243902439) + | (10,10) | [(10,-10),(-3,-4)] | (2.39024390243902,-6.48780487804878) + | (0,0) | [(-1000000,200),(300000,-40)] | (0.0028402365895872,15.384614860264) + | (-10,0) | [(-1000000,200),(300000,-40)] | (-9.99715942258202,15.3864610140472) + | (-3,4) | [(-1000000,200),(300000,-40)] | (-2.99789812267519,15.3851688427303) + | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221496,15.3836744976925) + | (-5,-12) | [(-1000000,200),(300000,-40)] | (-4.99494420845634,15.3855375281616) + | (10,10) | [(-1000000,200),(300000,-40)] | (10.000993741978,15.3827690473092) + | (0,0) | [(11,22),(33,44)] | (11,22) + | (-10,0) | [(11,22),(33,44)] | (11,22) + | (-3,4) | [(11,22),(33,44)] | (11,22) + | (5.1,34.5) | [(11,22),(33,44)] | (14.3,25.3) + | (-5,-12) | [(11,22),(33,44)] | (11,22) + | (10,10) | [(11,22),(33,44)] | (11,22) +(30 rows) + +-- +-- Lines +-- +-- +-- Boxes +-- +SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL; + six | box +-----+---------------------------------------------------------------------------- + | (2.12132034355964,2.12132034355964),(-2.12132034355964,-2.12132034355964) + | (71.7106781186547,72.7106781186547),(-69.7106781186547,-68.7106781186547) + | (4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932737) + | (3.12132034355964,4.12132034355964),(-1.12132034355964,-0.121320343559642) + | (107.071067811865,207.071067811865),(92.9289321881345,192.928932188135) + | (170.710678118655,70.7106781186547),(29.2893218813453,-70.7106781186547) +(6 rows) + +-- translation +SELECT '' AS twentyfour, b.f1 + p.f1 AS translation + FROM BOX_TBL b, POINT_TBL p; + twentyfour | translation +------------+------------------------- + | (2,2),(0,0) + | (-8,2),(-10,0) + | (-1,6),(-3,4) + | (7.1,36.5),(5.1,34.5) + | (-3,-10),(-5,-12) + | (12,12),(10,10) + | (3,3),(1,1) + | (-7,3),(-9,1) + | (0,7),(-2,5) + | (8.1,37.5),(6.1,35.5) + | (-2,-9),(-4,-11) + | (13,13),(11,11) + | (2.5,3.5),(2.5,2.5) + | (-7.5,3.5),(-7.5,2.5) + | (-0.5,7.5),(-0.5,6.5) + | (7.6,38),(7.6,37) + | (-2.5,-8.5),(-2.5,-9.5) + | (12.5,13.5),(12.5,12.5) + | (3,3),(3,3) + | (-7,3),(-7,3) + | (0,7),(0,7) + | (8.1,37.5),(8.1,37.5) + | (-2,-9),(-2,-9) + | (13,13),(13,13) +(24 rows) + +SELECT '' AS twentyfour, b.f1 - p.f1 AS translation + FROM BOX_TBL b, POINT_TBL p; + twentyfour | translation +------------+--------------------------- + | (2,2),(0,0) + | (12,2),(10,0) + | (5,-2),(3,-4) + | (-3.1,-32.5),(-5.1,-34.5) + | (7,14),(5,12) + | (-8,-8),(-10,-10) + | (3,3),(1,1) + | (13,3),(11,1) + | (6,-1),(4,-3) + | (-2.1,-31.5),(-4.1,-33.5) + | (8,15),(6,13) + | (-7,-7),(-9,-9) + | (2.5,3.5),(2.5,2.5) + | (12.5,3.5),(12.5,2.5) + | (5.5,-0.5),(5.5,-1.5) + | (-2.6,-31),(-2.6,-32) + | (7.5,15.5),(7.5,14.5) + | (-7.5,-6.5),(-7.5,-7.5) + | (3,3),(3,3) + | (13,3),(13,3) + | (6,-1),(6,-1) + | (-2.1,-31.5),(-2.1,-31.5) + | (8,15),(8,15) + | (-7,-7),(-7,-7) +(24 rows) + +-- scaling and rotation +SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation + FROM BOX_TBL b, POINT_TBL p; + twentyfour | rotation +------------+----------------------------- + | (0,0),(0,0) + | (-0,0),(-20,-20) + | (-0,2),(-14,0) + | (0,79.2),(-58.8,0) + | (14,-0),(0,-34) + | (0,40),(0,0) + | (0,0),(0,0) + | (-10,-10),(-30,-30) + | (-7,3),(-21,1) + | (-29.4,118.8),(-88.2,39.6) + | (21,-17),(7,-51) + | (0,60),(0,20) + | (0,0),(0,0) + | (-25,-25),(-25,-35) + | (-17.5,2.5),(-21.5,-0.5) + | (-73.5,104.1),(-108,99) + | (29.5,-42.5),(17.5,-47.5) + | (0,60),(-10,50) + | (0,0),(0,0) + | (-30,-30),(-30,-30) + | (-21,3),(-21,3) + | (-88.2,118.8),(-88.2,118.8) + | (21,-51),(21,-51) + | (0,60),(0,60) +(24 rows) + +SELECT '' AS twenty, b.f1 / p.f1 AS rotation + FROM BOX_TBL b, POINT_TBL p + WHERE (p.f1 <-> point '(0,0)') >= 1; + twenty | rotation +--------+----------------------------------------------------------------------------------- + | (0,-0),(-0.2,-0.2) + | (-0.1,-0.1),(-0.3,-0.3) + | (-0.25,-0.25),(-0.25,-0.35) + | (-0.3,-0.3),(-0.3,-0.3) + | (0.08,-0),(0,-0.56) + | (0.12,-0.28),(0.04,-0.84) + | (0.26,-0.7),(0.1,-0.82) + | (0.12,-0.84),(0.12,-0.84) + | (0.0651176557643925,0),(0,-0.0483449262493217) + | (0.0976764836465887,-0.0241724631246608),(0.0325588278821962,-0.0725173893739825) + | (0.109762715208919,-0.0562379754328844),(0.0813970697054906,-0.0604311578116521) + | (0.0976764836465887,-0.0725173893739825),(0.0976764836465887,-0.0725173893739825) + | (-0,0.0828402366863905),(-0.201183431952663,0) + | (-0.100591715976331,0.124260355029586),(-0.301775147928994,0.0414201183431953) + | (-0.251479289940828,0.103550295857988),(-0.322485207100592,0.0739644970414201) + | (-0.301775147928994,0.124260355029586),(-0.301775147928994,0.124260355029586) + | (0.2,0),(0,0) + | (0.3,0),(0.1,0) + | (0.3,0.05),(0.25,0) + | (0.3,0),(0.3,0) +(20 rows) + +-- +-- Paths +-- +SET geqo TO 'off'; +SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL; + eight | npoints | path +-------+---------+--------------------------- + | 2 | [(1,2),(3,4)] + | 2 | ((1,2),(3,4)) + | 4 | [(0,0),(3,0),(4,5),(1,6)] + | 2 | ((1,2),(3,4)) + | 2 | ((1,2),(3,4)) + | 2 | [(1,2),(3,4)] + | 2 | [(11,12),(13,14)] + | 2 | ((11,12),(13,14)) +(8 rows) + +SELECT '' AS four, path(f1) FROM POLYGON_TBL; + four | path +------+--------------------- + | ((2,0),(2,4),(0,0)) + | ((3,1),(3,3),(1,0)) + | ((0,0)) + | ((0,1),(0,1)) +(4 rows) + +-- translation +SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add + FROM PATH_TBL p1; + eight | dist_add +-------+----------------------------------- + | [(11,12),(13,14)] + | ((11,12),(13,14)) + | [(10,10),(13,10),(14,15),(11,16)] + | ((11,12),(13,14)) + | ((11,12),(13,14)) + | [(11,12),(13,14)] + | [(21,22),(23,24)] + | ((21,22),(23,24)) +(8 rows) + +-- scaling and rotation +SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul + FROM PATH_TBL p1; + eight | dist_mul +-------+------------------------------ + | [(4,3),(10,5)] + | ((4,3),(10,5)) + | [(0,0),(6,-3),(13,6),(8,11)] + | ((4,3),(10,5)) + | ((4,3),(10,5)) + | [(4,3),(10,5)] + | [(34,13),(40,15)] + | ((34,13),(40,15)) +(8 rows) + +RESET geqo; +-- +-- Polygons +-- +-- containment +SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 ~ p.f1 AS contains + FROM POLYGON_TBL poly, POINT_TBL p; + twentyfour | f1 | f1 | contains +------------+------------+---------------------+---------- + | (0,0) | ((2,0),(2,4),(0,0)) | t + | (-10,0) | ((2,0),(2,4),(0,0)) | f + | (-3,4) | ((2,0),(2,4),(0,0)) | f + | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f + | (-5,-12) | ((2,0),(2,4),(0,0)) | f + | (10,10) | ((2,0),(2,4),(0,0)) | f + | (0,0) | ((3,1),(3,3),(1,0)) | f + | (-10,0) | ((3,1),(3,3),(1,0)) | f + | (-3,4) | ((3,1),(3,3),(1,0)) | f + | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f + | (-5,-12) | ((3,1),(3,3),(1,0)) | f + | (10,10) | ((3,1),(3,3),(1,0)) | f + | (0,0) | ((0,0)) | t + | (-10,0) | ((0,0)) | f + | (-3,4) | ((0,0)) | f + | (5.1,34.5) | ((0,0)) | f + | (-5,-12) | ((0,0)) | f + | (10,10) | ((0,0)) | f + | (0,0) | ((0,1),(0,1)) | f + | (-10,0) | ((0,1),(0,1)) | f + | (-3,4) | ((0,1),(0,1)) | f + | (5.1,34.5) | ((0,1),(0,1)) | f + | (-5,-12) | ((0,1),(0,1)) | f + | (10,10) | ((0,1),(0,1)) | f +(24 rows) + +SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained + FROM POLYGON_TBL poly, POINT_TBL p; + twentyfour | f1 | f1 | contained +------------+------------+---------------------+----------- + | (0,0) | ((2,0),(2,4),(0,0)) | t + | (-10,0) | ((2,0),(2,4),(0,0)) | f + | (-3,4) | ((2,0),(2,4),(0,0)) | f + | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f + | (-5,-12) | ((2,0),(2,4),(0,0)) | f + | (10,10) | ((2,0),(2,4),(0,0)) | f + | (0,0) | ((3,1),(3,3),(1,0)) | f + | (-10,0) | ((3,1),(3,3),(1,0)) | f + | (-3,4) | ((3,1),(3,3),(1,0)) | f + | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f + | (-5,-12) | ((3,1),(3,3),(1,0)) | f + | (10,10) | ((3,1),(3,3),(1,0)) | f + | (0,0) | ((0,0)) | t + | (-10,0) | ((0,0)) | f + | (-3,4) | ((0,0)) | f + | (5.1,34.5) | ((0,0)) | f + | (-5,-12) | ((0,0)) | f + | (10,10) | ((0,0)) | f + | (0,0) | ((0,1),(0,1)) | f + | (-10,0) | ((0,1),(0,1)) | f + | (-3,4) | ((0,1),(0,1)) | f + | (5.1,34.5) | ((0,1),(0,1)) | f + | (-5,-12) | ((0,1),(0,1)) | f + | (10,10) | ((0,1),(0,1)) | f +(24 rows) + +SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon + FROM POLYGON_TBL; + four | npoints | polygon +------+---------+--------------------- + | 3 | ((2,0),(2,4),(0,0)) + | 3 | ((3,1),(3,3),(1,0)) + | 1 | ((0,0)) + | 2 | ((0,1),(0,1)) +(4 rows) + +SELECT '' AS four, polygon(f1) + FROM BOX_TBL; + four | polygon +------+------------------------------------------- + | ((0,0),(0,2),(2,2),(2,0)) + | ((1,1),(1,3),(3,3),(3,1)) + | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5)) + | ((3,3),(3,3),(3,3),(3,3)) +(4 rows) + +SELECT '' AS four, polygon(f1) + FROM PATH_TBL WHERE isclosed(f1); + four | polygon +------+------------------- + | ((1,2),(3,4)) + | ((1,2),(3,4)) + | ((1,2),(3,4)) + | ((11,12),(13,14)) +(4 rows) + +SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon + FROM PATH_TBL + WHERE isopen(f1); + four | open_path | polygon +------+---------------------------+--------------------------- + | [(1,2),(3,4)] | ((1,2),(3,4)) + | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6)) + | [(1,2),(3,4)] | ((1,2),(3,4)) + | [(11,12),(13,14)] | ((11,12),(13,14)) +(4 rows) + +-- convert circles to polygons using the default number of points +SELECT '' AS six, polygon(f1) + FROM CIRCLE_TBL; + six | polygon +-----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + | ((-3,0),(-2.59807621135076,1.50000000000442),(-1.49999999999116,2.59807621135842),(1.53102359078377e-11,3),(1.50000000001768,2.59807621134311),(2.59807621136607,1.4999999999779),(3,-3.06204718156754e-11),(2.59807621133545,-1.50000000003094),(1.49999999996464,-2.59807621137373),(-4.59307077235131e-11,-3),(-1.5000000000442,-2.5980762113278),(-2.59807621138138,-1.49999999995138)) + | ((-99,2),(-85.6025403783588,52.0000000001473),(-48.9999999997054,88.602540378614),(1.00000000051034,102),(51.0000000005893,88.6025403781036),(87.6025403788692,51.9999999992634),(101,1.99999999897932),(87.6025403778485,-48.0000000010313),(50.9999999988214,-84.6025403791243),(0.999999998468976,-98),(-49.0000000014732,-84.6025403775933),(-85.6025403793795,-47.9999999983795)) + | ((-4,3),(-3.33012701891794,5.50000000000737),(-1.49999999998527,7.3301270189307),(1.00000000002552,8),(3.50000000002946,7.33012701890518),(5.33012701894346,5.49999999996317),(6,2.99999999994897),(5.33012701889242,0.499999999948437),(3.49999999994107,-1.33012701895622),(0.999999999923449,-2),(-1.50000000007366,-1.33012701887967),(-3.33012701896897,0.500000000081028)) + | ((-2,2),(-1.59807621135076,3.50000000000442),(-0.499999999991161,4.59807621135842),(1.00000000001531,5),(2.50000000001768,4.59807621134311),(3.59807621136607,3.4999999999779),(4,1.99999999996938),(3.59807621133545,0.499999999969062),(2.49999999996464,-0.598076211373729),(0.999999999954069,-1),(-0.500000000044197,-0.598076211327799),(-1.59807621138138,0.500000000048616)) + | ((90,200),(91.3397459621641,205.000000000015),(95.0000000000295,208.660254037861),(100.000000000051,210),(105.000000000059,208.66025403781),(108.660254037887,204.999999999926),(110,199.999999999898),(108.660254037785,194.999999999897),(104.999999999882,191.339745962088),(99.9999999998469,190),(94.9999999998527,191.339745962241),(91.3397459620621,195.000000000162)) + | ((0,0),(13.3974596216412,50.0000000001473),(50.0000000002946,86.602540378614),(100.00000000051,100),(150.000000000589,86.6025403781036),(186.602540378869,49.9999999992634),(200,-1.02068239385585e-09),(186.602540377848,-50.0000000010313),(149.999999998821,-86.6025403791243),(99.999999998469,-100),(49.9999999985268,-86.6025403775933),(13.3974596206205,-49.9999999983795)) +(6 rows) + +-- convert the circle to an 8-point polygon +SELECT '' AS six, polygon(8, f1) + FROM CIRCLE_TBL; + six | polygon +-----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + | ((-3,0),(-2.12132034355423,2.12132034356506),(1.53102359078377e-11,3),(2.12132034357588,2.1213203435434),(3,-3.06204718156754e-11),(2.12132034353258,-2.12132034358671),(-4.59307077235131e-11,-3),(-2.12132034359753,-2.12132034352175)) + | ((-99,2),(-69.7106781184743,72.7106781188352),(1.00000000051034,102),(71.710678119196,72.7106781181134),(101,1.99999999897932),(71.7106781177526,-68.7106781195569),(0.999999998468976,-98),(-69.7106781199178,-68.7106781173917)) + | ((-4,3),(-2.53553390592372,6.53553390594176),(1.00000000002552,8),(4.5355339059598,6.53553390590567),(6,2.99999999994897),(4.53553390588763,-0.535533905977846),(0.999999999923449,-2),(-2.53553390599589,-0.535533905869586)) + | ((-2,2),(-1.12132034355423,4.12132034356506),(1.00000000001531,5),(3.12132034357588,4.1213203435434),(4,1.99999999996938),(3.12132034353258,-0.121320343586707),(0.999999999954069,-1),(-1.12132034359753,-0.121320343521752)) + | ((90,200),(92.9289321881526,207.071067811884),(100.000000000051,210),(107.07106781192,207.071067811811),(110,199.999999999898),(107.071067811775,192.928932188044),(99.9999999998469,190),(92.9289321880082,192.928932188261)) + | ((0,0),(29.2893218815257,70.7106781188352),(100.00000000051,100),(170.710678119196,70.7106781181134),(200,-1.02068239385585e-09),(170.710678117753,-70.7106781195569),(99.999999998469,-100),(29.2893218800822,-70.7106781173917)) +(6 rows) + +-- +-- Circles +-- +SELECT '' AS six, circle(f1, 50.0) + FROM POINT_TBL; + six | circle +-----+----------------- + | <(0,0),50> + | <(-10,0),50> + | <(-3,4),50> + | <(5.1,34.5),50> + | <(-5,-12),50> + | <(10,10),50> +(6 rows) + +SELECT '' AS four, circle(f1) + FROM BOX_TBL; + four | circle +------+------------------------- + | <(1,1),1.4142135623731> + | <(2,2),1.4142135623731> + | <(2.5,3),0.5> + | <(3,3),0> +(4 rows) + +SELECT '' AS two, circle(f1) + FROM POLYGON_TBL + WHERE (# f1) >= 3; + two | circle +-----+-------------------------------------------------------- + | <(1.33333333333333,1.33333333333333),2.04168905063636> + | <(2.33333333333333,1.33333333333333),1.47534300379185> +(2 rows) + +SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance + FROM CIRCLE_TBL c1, POINT_TBL p1 + WHERE (p1.f1 <-> c1.f1) > 0 + ORDER BY distance, circle, point using <<; + twentyfour | circle | point | distance +------------+----------------+------------+------------------ + | <(100,0),100> | (5.1,34.5) | 0.97653192697797 + | <(1,2),3> | (-3,4) | 1.47213595499958 + | <(0,0),3> | (-3,4) | 2 + | <(100,0),100> | (-3,4) | 3.07764064044152 + | <(100,0),100> | (-5,-12) | 5.68348972285122 + | <(1,3),5> | (-10,0) | 6.40175425099138 + | <(1,3),5> | (10,10) | 6.40175425099138 + | <(0,0),3> | (-10,0) | 7 + | <(1,2),3> | (-10,0) | 8.18033988749895 + | <(1,2),3> | (10,10) | 9.0415945787923 + | <(0,0),3> | (-5,-12) | 10 + | <(100,0),100> | (-10,0) | 10 + | <(0,0),3> | (10,10) | 11.142135623731 + | <(1,3),5> | (-5,-12) | 11.1554944214035 + | <(1,2),3> | (-5,-12) | 12.2315462117278 + | <(1,3),5> | (5.1,34.5) | 26.7657047773223 + | <(1,2),3> | (5.1,34.5) | 29.757594539282 + | <(0,0),3> | (5.1,34.5) | 31.8749193547455 + | <(100,200),10> | (5.1,34.5) | 180.778038568384 + | <(100,200),10> | (10,10) | 200.237960416286 + | <(100,200),10> | (-3,4) | 211.415898254845 + | <(100,200),10> | (0,0) | 213.606797749979 + | <(100,200),10> | (-10,0) | 218.254244210267 + | <(100,200),10> | (-5,-12) | 226.577682802077 +(24 rows) + |