JDBC Patch

Started by Christopher Cainalmost 26 years ago12 messagespatches
Jump to latest
#1Christopher Cain
ccain@mhsoftware.com

This patch for the 7.0.2 JDBC interface addresses four issues I
encountered while getting my reporting tool up and running with the
driver. All changes are in the DatabaseMetaData class.

Problem: The getDatabaseProductVersion() method was returning "6.5.2"
Resolution: Changed it to return "7.0.2"

Problem: A call to getTables() with an unsupported table type (in the
String array) resulted in a malformed SQL statement and subsequent
parsing error
Resolution: Unsupported table types are now ignored without error

Problem: In a getTables() call, tables and views were both returned by
the "TABLE" table type, and the "VIEW" table type was unsupported
Resolution: Changed the "TABLE" type to return only physical tables and
added support for the "VIEW" table type (returning only views)

Problem: The getIdentifierQuoteString() method was returning null
Resolution: This method now returns a double-quote

Regards ...

- Christopher

Attachments:

jdbc-0824.patchtext/plain; charset=us-ascii; name=jdbc-0824.patchDownload+14-12
#2Peter T Mount
peter@retep.org.uk
In reply to: Christopher Cain (#1)
RE: JDBC Patch

Hmmm, I thought I had caught all the version strings. Thanks for spotting
it.

I'll commit that one and the others later today.

Peter

-----Original Message-----
From: Christopher Cain [mailto:ccain@mhsoftware.com]
Sent: Thursday, August 24, 2000 8:30 PM
To: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.org
Subject: [INTERFACES] JDBC Patch

This patch for the 7.0.2 JDBC interface addresses four issues I
encountered while getting my reporting tool up and running with the
driver. All changes are in the DatabaseMetaData class.

Problem: The getDatabaseProductVersion() method was returning "6.5.2"
Resolution: Changed it to return "7.0.2"

Problem: A call to getTables() with an unsupported table type (in the
String array) resulted in a malformed SQL statement and subsequent
parsing error
Resolution: Unsupported table types are now ignored without error

Problem: In a getTables() call, tables and views were both returned by
the "TABLE" table type, and the "VIEW" table type was unsupported
Resolution: Changed the "TABLE" type to return only physical tables and
added support for the "VIEW" table type (returning only views)

Problem: The getIdentifierQuoteString() method was returning null
Resolution: This method now returns a double-quote

Regards ...

- Christopher

#3Peter T Mount
peter@retep.org.uk
In reply to: Peter T Mount (#2)
RE: JDBC Patch

The problem is that there are so many different places it can go. I was
thinking of moving the version stuff into DriverClass.java (which is built
dynamically by make), but I'm not sure how adding malefile.global would
affect the compilation process.

However, JDBC needs:

Full string: "7.0.2"
Major version: 7
Minor version: 0

and those are just from memory.

If I get chance today, I'll look into it.

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@it.maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Friday, August 25, 2000 9:28 AM
To: Peter Mount
Cc: 'Christopher Cain'; pgsql-interfaces@postgresql.org;
pgsql-patches@postgresql.org
Subject: RE: [INTERFACES] JDBC Patch

Peter Mount writes:

Hmmm, I thought I had caught all the version strings. Thanks for spotting
it.

Peter, you can avoid this sort of thing in the future. Makefile.global
defines a variable `VERSION' that you should compile into the binaries.
I'm not sure exactly how it would work with Java, but perhaps something
like this:

javac -Dversion='"$(VERSION)"' xyz.java

or run sed before the compilation.

--
Peter Eisentraut Sernanders v�g 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden

#4Bryan Field-Elliot
bryan@netmeme.org
In reply to: Christopher Cain (#1)
JDBC and java.sql.Timestamp

Using the latest stable postgres and JDBC drivers, I am having a problem
which I have seen mentioned here previously; namely, that after inserting a
row with a Timestamp column, and while attempting to retrieve it again (via
JDBC), I get exceptions; I believe this is due to a bug in the format string
in the jdbc client.

Some have mentioned that a fix is available in CVS, but (believe or not) I
am newbie enough to have not yet used CVS or know how to retrieve patches
via it.

Is there a released (downloadable, even RPM-downloadable) version of the
JDBC driver with the Timestamp issue fixed?

Thanks in advance,

Bryan

#5Joseph Shraibman
jks@selectacast.net
In reply to: Christopher Cain (#1)
Re: JDBC and java.sql.Timestamp

I'm thinking it would justify a 7.0.3 release of postgres just to keep
the traffic about the Timestamp off the mailing list.

Bryan Field-Elliot wrote:

Using the latest stable postgres and JDBC drivers, I am having a problem
which I have seen mentioned here previously; namely, that after inserting a
row with a Timestamp column, and while attempting to retrieve it again (via
JDBC), I get exceptions; I believe this is due to a bug in the format string
in the jdbc client.

Some have mentioned that a fix is available in CVS, but (believe or not) I
am newbie enough to have not yet used CVS or know how to retrieve patches
via it.

Is there a released (downloadable, even RPM-downloadable) version of the
JDBC driver with the Timestamp issue fixed?

The official jdbc homepage is http://www.retep.org.uk/postgres/ but it
appears to be the 7.0 driver. Peter?

Show quoted text

Thanks in advance,

Bryan

#6Peter T Mount
peter@retep.org.uk
In reply to: Christopher Cain (#1)
Re: JDBC and java.sql.Timestamp

Should be by the end of Monday.

Peter

--
Peter T Mount peter@retep.org.uk, me@petermount.com
Homepage: http://www.retep.org.uk Contact details: http://petermount.com
PostgreSQL JDBC: http://www.retep.org.uk/postgres/
Java PDF Generator: http://www.retep.org.uk/pdf/
----- Original Message -----
From: "Bryan Field-Elliot" <bryan@netmeme.org>
To: <pgsql-interfaces@postgresql.org>
Sent: Friday, August 25, 2000 7:25 PM
Subject: [INTERFACES] JDBC and java.sql.Timestamp

Using the latest stable postgres and JDBC drivers, I am having a problem
which I have seen mentioned here previously; namely, that after inserting

a

row with a Timestamp column, and while attempting to retrieve it again

(via

JDBC), I get exceptions; I believe this is due to a bug in the format

string

Show quoted text

in the jdbc client.

Some have mentioned that a fix is available in CVS, but (believe or not) I
am newbie enough to have not yet used CVS or know how to retrieve patches
via it.

Is there a released (downloadable, even RPM-downloadable) version of the
JDBC driver with the Timestamp issue fixed?

Thanks in advance,

Bryan

#7Peter T Mount
peter@retep.org.uk
In reply to: Christopher Cain (#1)
Re: JDBC and java.sql.Timestamp

Also, because I've been busy the last few months, I've not done anything
since 7.0 was released. I'm spending Monday catching up with the major
outstanding stuff with JDBC, and will get a compiled copy online.

Peter

--
Peter T Mount peter@retep.org.uk, me@petermount.com
Homepage: http://www.retep.org.uk Contact details: http://petermount.com
PostgreSQL JDBC: http://www.retep.org.uk/postgres/
Java PDF Generator: http://www.retep.org.uk/pdf/
----- Original Message -----
From: "Joseph Shraibman" <jks@selectacast.net>
To: <pgsql-interfaces@postgresql.org>
Sent: Friday, August 25, 2000 8:29 PM
Subject: Re: [INTERFACES] JDBC and java.sql.Timestamp

I'm thinking it would justify a 7.0.3 release of postgres just to keep
the traffic about the Timestamp off the mailing list.

Bryan Field-Elliot wrote:

Using the latest stable postgres and JDBC drivers, I am having a problem
which I have seen mentioned here previously; namely, that after

inserting a

row with a Timestamp column, and while attempting to retrieve it again

(via

JDBC), I get exceptions; I believe this is due to a bug in the format

string

in the jdbc client.

Some have mentioned that a fix is available in CVS, but (believe or not)

I

am newbie enough to have not yet used CVS or know how to retrieve

patches

Show quoted text

via it.

Is there a released (downloadable, even RPM-downloadable) version of the
JDBC driver with the Timestamp issue fixed?

The official jdbc homepage is http://www.retep.org.uk/postgres/ but it
appears to be the 7.0 driver. Peter?

Thanks in advance,

Bryan

#8Bruce Momjian
bruce@momjian.us
In reply to: Christopher Cain (#1)
Re: [PATCHES] JDBC Patch

Applied. Thanks.

This patch for the 7.0.2 JDBC interface addresses four issues I
encountered while getting my reporting tool up and running with the
driver. All changes are in the DatabaseMetaData class.

Problem: The getDatabaseProductVersion() method was returning "6.5.2"
Resolution: Changed it to return "7.0.2"

Problem: A call to getTables() with an unsupported table type (in the
String array) resulted in a malformed SQL statement and subsequent
parsing error
Resolution: Unsupported table types are now ignored without error

Problem: In a getTables() call, tables and views were both returned by
the "TABLE" table type, and the "VIEW" table type was unsupported
Resolution: Changed the "TABLE" type to return only physical tables and
added support for the "VIEW" table type (returning only views)

Problem: The getIdentifierQuoteString() method was returning null
Resolution: This method now returns a double-quote

Regards ...

- Christopher

diff -U 5 -r postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java
--- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java	Mon Apr 17 14:07:48 2000
+++ postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.java	Thu Aug 24 11:42:28 2000
@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
-    return ("6.5.2");
+    return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class where (");
boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and relname !~ '^xinv')"},
+    {"TABLE",		"(relkind='r' and relhasrules='f' and relname !~ '^pg_' and relname !~ '^xinv')"},
+    {"VIEW",		"(relkind='r' and relhasrules='t' and relname !~ '^pg_' and relname !~ '^xinv')"},
{"INDEX",		"(relkind='i' and relname !~ '^pg_' and relname !~ '^xinx')"},
{"LARGE OBJECT",	"(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE",	"(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE",	"(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX",	"(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database.  The results
* are ordered by schema name.
diff -U 5 -r postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
--- postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java	Mon Apr 17 14:07:50 2000
+++ postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java	Wed Aug 23 15:14:50 2000
@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
-    return ("6.5.2");
+    return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class where (");
boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and relname !~ '^xinv')"},
+    {"TABLE",		"(relkind='r' and relhasrules='f' and relname !~ '^pg_' and relname !~ '^xinv')"},
+    {"VIEW",		"(relkind='r' and relhasrules='t' and relname !~ '^pg_' and relname !~ '^xinv')"},
{"INDEX",		"(relkind='i' and relname !~ '^pg_' and relname !~ '^xinx')"},
{"LARGE OBJECT",	"(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE",	"(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE",	"(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX",	"(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database. The results
* are ordered by schema name.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#9Peter T Mount
peter@retep.org.uk
In reply to: Bruce Momjian (#8)
RE: [PATCHES] JDBC Patch

Eeek, I've got this in my copy ready to commit. How is CVS going to handle
this problem?

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Tuesday, September 12, 2000 5:17 AM
To: Christopher Cain
Cc: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.org
Subject: Re: [PATCHES] JDBC Patch

Applied. Thanks.

This patch for the 7.0.2 JDBC interface addresses four issues I
encountered while getting my reporting tool up and running with the
driver. All changes are in the DatabaseMetaData class.

Problem: The getDatabaseProductVersion() method was returning "6.5.2"
Resolution: Changed it to return "7.0.2"

Problem: A call to getTables() with an unsupported table type (in the
String array) resulted in a malformed SQL statement and subsequent
parsing error
Resolution: Unsupported table types are now ignored without error

Problem: In a getTables() call, tables and views were both returned by
the "TABLE" table type, and the "VIEW" table type was unsupported
Resolution: Changed the "TABLE" type to return only physical tables and
added support for the "VIEW" table type (returning only views)

Problem: The getIdentifierQuoteString() method was returning null
Resolution: This method now returns a double-quote

Regards ...

- Christopher

diff -U 5 -r

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
ava
postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
java

---

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
ava Mon Apr 17 14:07:48 2000

+++

postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
java Thu Aug 24 11:42:28 2000

@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
- return ("6.5.2");
+ return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class

where (");

boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and

relname !~ '^xinv')"},

+ {"TABLE", "(relkind='r' and relhasrules='f' and

relname !~ '^pg_' and relname !~ '^xinv')"},

+ {"VIEW", "(relkind='r' and relhasrules='t' and relname !~

'^pg_' and relname !~ '^xinv')"},

{"INDEX", "(relkind='i' and relname !~ '^pg_' and

relname !~ '^xinx')"},

{"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database. The results
* are ordered by schema name.
diff -U 5 -r

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
ava
postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
java

---

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
ava Mon Apr 17 14:07:50 2000

+++

postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
java Wed Aug 23 15:14:50 2000

@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
- return ("6.5.2");
+ return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class

where (");

boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and

relname !~ '^xinv')"},

+ {"TABLE", "(relkind='r' and relhasrules='f' and

relname !~ '^pg_' and relname !~ '^xinv')"},

+ {"VIEW", "(relkind='r' and relhasrules='t' and relname !~

'^pg_' and relname !~ '^xinv')"},

{"INDEX", "(relkind='i' and relname !~ '^pg_' and

relname !~ '^xinx')"},

{"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database. The results
* are ordered by schema name.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter T Mount (#9)
Re: [PATCHES] JDBC Patch

Peter Mount <petermount@maidstone.gov.uk> writes:

Eeek, I've got this in my copy ready to commit. How is CVS going to handle
this problem?

You'll have to "cvs update" those files and then check that the changes
were merged correctly before you commit. I believe CVS will not let
you commit a file in which there are changes since your last cvs update.

Although "cvs update" will try to merge the changes from the repository
with your local edits, my experience is that CVS is not too bright about
merging overlapping differences. I prefer to do the change merge by
hand --- move my modified files someplace else, cvs update to fetch
clean current copies, then edit to bring the files back in sync. This
process is a bit tedious, but much more reliable than CVS by itself.

Jan Wieck has posted about his preferred method, which IIRC involves
working in a complete separate copy of the source tree, and then
using "diff -c -R" to generate a summary of his changes. Then he
cvs update's his reference tree and uses "patch" to apply the
diff output to it, followed by hand cleanup of whatever merges patch
couldn't handle. This is probably a better way if you plan to do
a large pile of changes between syncs with the repository.

regards, tom lane

#11Peter T Mount
peter@retep.org.uk
In reply to: Tom Lane (#10)
RE: [PATCHES] JDBC Patch

Thanks, this follows previous experience where I've had to check out a fresh
set, run diff, and then merge by hand. It's just more tedious with only a
28k connection.

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Tuesday, September 12, 2000 8:16 AM
To: Peter Mount
Cc: 'Bruce Momjian'; Christopher Cain; pgsql-interfaces@postgresql.org;
pgsql-patches@postgresql.org
Subject: Re: [PATCHES] JDBC Patch

Peter Mount <petermount@maidstone.gov.uk> writes:

Eeek, I've got this in my copy ready to commit. How is CVS going to handle
this problem?

You'll have to "cvs update" those files and then check that the changes
were merged correctly before you commit. I believe CVS will not let
you commit a file in which there are changes since your last cvs update.

Although "cvs update" will try to merge the changes from the repository
with your local edits, my experience is that CVS is not too bright about
merging overlapping differences. I prefer to do the change merge by
hand --- move my modified files someplace else, cvs update to fetch
clean current copies, then edit to bring the files back in sync. This
process is a bit tedious, but much more reliable than CVS by itself.

Jan Wieck has posted about his preferred method, which IIRC involves
working in a complete separate copy of the source tree, and then
using "diff -c -R" to generate a summary of his changes. Then he
cvs update's his reference tree and uses "patch" to apply the
diff output to it, followed by hand cleanup of whatever merges patch
couldn't handle. This is probably a better way if you plan to do
a large pile of changes between syncs with the repository.

regards, tom lane

#12Bruce Momjian
bruce@momjian.us
In reply to: Peter T Mount (#9)
Re: [PATCHES] JDBC Patch

[ Charset ISO-8859-1 unsupported, converting... ]

Eeek, I've got this in my copy ready to commit. How is CVS going to handle
this problem?

Do a cvs update and see if it skips those changes.

Peter

--
Peter Mount
Enterprise Support Officer, Maidstone Borough Council
Email: petermount@maidstone.gov.uk
WWW: http://www.maidstone.gov.uk
All views expressed within this email are not the views of Maidstone Borough
Council

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Tuesday, September 12, 2000 5:17 AM
To: Christopher Cain
Cc: pgsql-interfaces@postgresql.org; pgsql-patches@postgresql.org
Subject: Re: [PATCHES] JDBC Patch

Applied. Thanks.

This patch for the 7.0.2 JDBC interface addresses four issues I
encountered while getting my reporting tool up and running with the
driver. All changes are in the DatabaseMetaData class.

Problem: The getDatabaseProductVersion() method was returning "6.5.2"
Resolution: Changed it to return "7.0.2"

Problem: A call to getTables() with an unsupported table type (in the
String array) resulted in a malformed SQL statement and subsequent
parsing error
Resolution: Unsupported table types are now ignored without error

Problem: In a getTables() call, tables and views were both returned by
the "TABLE" table type, and the "VIEW" table type was unsupported
Resolution: Changed the "TABLE" type to return only physical tables and
added support for the "VIEW" table type (returning only views)

Problem: The getIdentifierQuoteString() method was returning null
Resolution: This method now returns a double-quote

Regards ...

- Christopher

diff -U 5 -r

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
ava
postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
java

---

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.j
ava Mon Apr 17 14:07:48 2000

+++

postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc1/DatabaseMetaData.
java Thu Aug 24 11:42:28 2000

@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
- return ("6.5.2");
+ return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class

where (");

boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and

relname !~ '^xinv')"},

+ {"TABLE", "(relkind='r' and relhasrules='f' and

relname !~ '^pg_' and relname !~ '^xinv')"},

+ {"VIEW", "(relkind='r' and relhasrules='t' and relname !~

'^pg_' and relname !~ '^xinv')"},

{"INDEX", "(relkind='i' and relname !~ '^pg_' and

relname !~ '^xinx')"},

{"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database. The results
* are ordered by schema name.
diff -U 5 -r

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
ava
postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
java

---

postgresql-7.0.2/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.j
ava Mon Apr 17 14:07:50 2000

+++

postgresql-7.0.2a/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.
java Wed Aug 23 15:14:50 2000

@@ -177,11 +177,11 @@
* @return the database version
* @exception SQLException if a database access error occurs
*/
public String getDatabaseProductVersion() throws SQLException
{
- return ("6.5.2");
+ return ("7.0.2");
}

/**
* What is the name of this JDBC driver? If we don't know this
* we are doing something wrong!
@@ -361,11 +361,11 @@
* @return the quoting string
* @exception SQLException if a database access error occurs
*/
public String getIdentifierQuoteString() throws SQLException
{
- return null;
+ return "\"";
}

/**
* Get a comma separated list of all a database's SQL keywords that
* are NOT also SQL92 keywords.
@@ -1652,14 +1652,14 @@

// Now form the query
StringBuffer sql = new StringBuffer("select relname,oid from pg_class

where (");

boolean notFirst=false;
for(int i=0;i<types.length;i++) {
- if(notFirst)
- sql.append(" or ");
for(int j=0;j<getTableTypes.length;j++)
if(getTableTypes[j][0].equals(types[i])) {
+ if(notFirst)
+ sql.append(" or ");
sql.append(getTableTypes[j][1]);
notFirst=true;
}
}

@@ -1704,22 +1704,23 @@
// Each supported type consists of it's name, and the sql where
// clause to retrieve that value.
//
// IMPORTANT: the query must be enclosed in ( )
private static final String getTableTypes[][] = {
-    {"TABLE",		"(relkind='r' and relname !~ '^pg_' and

relname !~ '^xinv')"},

+ {"TABLE", "(relkind='r' and relhasrules='f' and

relname !~ '^pg_' and relname !~ '^xinv')"},

+ {"VIEW", "(relkind='r' and relhasrules='t' and relname !~

'^pg_' and relname !~ '^xinv')"},

{"INDEX", "(relkind='i' and relname !~ '^pg_' and

relname !~ '^xinx')"},

{"LARGE OBJECT", "(relkind='r' and relname ~ '^xinv')"},
{"SEQUENCE", "(relkind='S' and relname !~ '^pg_')"},
{"SYSTEM TABLE", "(relkind='r' and relname ~ '^pg_')"},
{"SYSTEM INDEX", "(relkind='i' and relname ~ '^pg_')"}
};

// These are the default tables, used when NULL is passed to getTables
// The choice of these provide the same behaviour as psql's \d
private static final String defaultTableTypes[] = {
- "TABLE","INDEX","SEQUENCE"
+ "TABLE","VIEW","INDEX","SEQUENCE"
};

/**
* Get the schema names available in this database. The results
* are ordered by schema name.

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 853-3000
+  If your life is a hard drive,     |  830 Blythe Avenue
+  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026