Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

postgresql.jdbc2
Class DatabaseMetaData  view DatabaseMetaData download DatabaseMetaData.java

java.lang.Object
  extended bypostgresql.jdbc2.DatabaseMetaData
All Implemented Interfaces:
java.sql.DatabaseMetaData

public class DatabaseMetaData
extends java.lang.Object
implements java.sql.DatabaseMetaData

This class provides information about the database as a whole.

Many of the methods here return lists of information in ResultSets. You can use the normal ResultSet methods such as getString and getInt to retrieve the data from these ResultSets. If a given form of metadata is not available, these methods should throw a SQLException.

Some of these methods take arguments that are String patterns. These arguments all have names such as fooPattern. Within a pattern String, "%" means match any substring of 0 or more characters, and "_" means match any one character. Only metadata entries matching the search pattern are returned. if a search pattern argument is set to a null ref, it means that argument's criteria should be dropped from the search.

A SQLException will be throws if a driver does not support a meta data method. In the case of methods that return a ResultSet, either a ResultSet (which may be empty) is returned or a SQLException is thrown.


Field Summary
(package private)  Connection connection
           
private static byte[] defaultRemarks
           
private static java.lang.String[] defaultTableTypes
           
private static java.lang.String[][] getTableTypes
           
(package private) static int iBoolOid
           
(package private) static int iInt2Oid
           
(package private) static int iInt4Oid
           
(package private) static int iVarcharOid
           
(package private) static int VARHDRSZ
           
 
Fields inherited from interface java.sql.DatabaseMetaData
attributeNoNulls, attributeNullable, attributeNullableUnknown, bestRowNotPseudo, bestRowPseudo, bestRowSession, bestRowTemporary, bestRowTransaction, bestRowUnknown, columnNoNulls, columnNullable, columnNullableUnknown, importedKeyCascade, importedKeyInitiallyDeferred, importedKeyInitiallyImmediate, importedKeyNoAction, importedKeyNotDeferrable, importedKeyRestrict, importedKeySetDefault, importedKeySetNull, procedureColumnIn, procedureColumnInOut, procedureColumnOut, procedureColumnResult, procedureColumnReturn, procedureColumnUnknown, procedureNoNulls, procedureNoResult, procedureNullable, procedureNullableUnknown, procedureResultUnknown, procedureReturnsResult, sqlStateSQL99, sqlStateXOpen, tableIndexClustered, tableIndexHashed, tableIndexOther, tableIndexStatistic, typeNoNulls, typeNullable, typeNullableUnknown, typePredBasic, typePredChar, typePredNone, typeSearchable, versionColumnNotPseudo, versionColumnPseudo, versionColumnUnknown
 
Constructor Summary
DatabaseMetaData(Connection conn)
           
 
Method Summary
 boolean allProceduresAreCallable()
          Can all the procedures returned by getProcedures be called by the current user?
 boolean allTablesAreSelectable()
          Can all the tables returned by getTable be SELECTed by the current user?
 boolean dataDefinitionCausesTransactionCommit()
          Does a data definition statement within a transaction force the transaction to commit? I think this means something like:
 boolean dataDefinitionIgnoredInTransactions()
          Is a data definition statement within a transaction ignored? It seems to be (from experiment in previous method)
 boolean deletesAreDetected(int i)
          This method tests whether or not the specified result set type can detect a visible delete by calling the rowUpdated method.
 boolean doesMaxRowSizeIncludeBlobs()
          Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY blobs? We don't handle blobs yet
 java.sql.ResultSet getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable)
          Get a description of a table's optimal set of columns that uniquely identifies a row.
 java.sql.ResultSet getCatalogs()
          Get the catalog names available in this database.
 java.lang.String getCatalogSeparator()
          What is the Catalog separator.
 java.lang.String getCatalogTerm()
          What is the database vendor's preferred term for "catalog"? - we dont have a preferred term, so just use Catalog
 java.lang.Class getClass(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
           
 java.sql.ResultSet getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
          Get a description of the access rights for a table's columns.
 java.sql.ResultSet getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)
          Get a description of table columns available in a catalog.
 java.sql.Connection getConnection()
          This method returns the Connection object that was used to generate the metadata in this object.
 java.sql.ResultSet getCrossReference(java.lang.String primaryCatalog, java.lang.String primarySchema, java.lang.String primaryTable, java.lang.String foreignCatalog, java.lang.String foreignSchema, java.lang.String foreignTable)
          Get a description of the foreign key columns in the foreign key table that reference the primary key columns of the primary key table (describe how one table imports another's key.) This should normally return a single foreign key/primary key pair (most tables only import a foreign key from a table once.) They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ.
 java.lang.String getDatabaseProductName()
          What is the name of this database product - we hope that it is PostgreSQL, so we return that explicitly.
 java.lang.String getDatabaseProductVersion()
          What is the version of this database product.
 int getDefaultTransactionIsolation()
          What is the database's default transaction isolation level? We do not support this, so all transactions are SERIALIZABLE.
 int getDriverMajorVersion()
          What is this JDBC driver's major version number?
 int getDriverMinorVersion()
          What is this JDBC driver's minor version number?
 java.lang.String getDriverName()
          What is the name of this JDBC driver? If we don't know this we are doing something wrong!
 java.lang.String getDriverVersion()
          What is the version string of this JDBC driver? Again, this is static.
 java.sql.ResultSet getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a foreign key columns that reference a table's primary key columns (the foreign keys exported by a table).
 java.lang.String getExtraNameCharacters()
          Get all the "extra" characters that can bew used in unquoted identifier names (those beyond a-zA-Z0-9 and _)
 java.lang.String getIdentifierQuoteString()
          What is the string used to quote SQL identifiers? This returns a space if identifier quoting isn't supported.
 java.sql.ResultSet getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of the primary key columns that are referenced by a table's foreign key columns (the primary keys imported by a table).
 java.sql.ResultSet getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate)
          Get a description of a table's indices and statistics.
 int getMaxBinaryLiteralLength()
          How many hex characters can you have in an inline binary literal
 int getMaxCatalogNameLength()
          This method returns the maximum length of a catalog name.
 int getMaxCharLiteralLength()
          What is the maximum length for a character literal I suppose it is 8190 (8192 - 2 for the quotes)
 int getMaxColumnNameLength()
          Whats the limit on column name length.
 int getMaxColumnsInGroupBy()
          What is the maximum number of columns in a "GROUP BY" clause?
 int getMaxColumnsInIndex()
          What's the maximum number of columns allowed in an index? 6.0 only allowed one column, but 6.1 introduced multi-column indices, so, theoretically, its all of them.
 int getMaxColumnsInOrderBy()
          What's the maximum number of columns in an "ORDER BY clause? Theoretically, all of them!
 int getMaxColumnsInSelect()
          What is the maximum number of columns in a "SELECT" list? Theoretically, all of them!
 int getMaxColumnsInTable()
          What is the maximum number of columns in a table? From the create_table(l) manual page...
 int getMaxConnections()
          How many active connection can we have at a time to this database? Well, since it depends on postmaster, which just does a listen() followed by an accept() and fork(), its basically very high.
 int getMaxCursorNameLength()
          What is the maximum cursor name length (the same as all the other F***** identifiers!)
 int getMaxIndexLength()
          What is the maximum length of an index (in bytes)? Now, does the spec.
 int getMaxProcedureNameLength()
          What is the maximum length of a procedure name? (length of pg_proc.proname used) - again, I really should do a query here to get it.
 int getMaxRowSize()
          What is the maximum length of a single row? (not including blobs).
 int getMaxSchemaNameLength()
          This method returns the maximum length of a schema name.
 int getMaxStatementLength()
          What is the maximum length of a SQL statement?
 int getMaxStatements()
          How many active statements can we have open at one time to this database? Basically, since each Statement downloads the results as the query is executed, we can have many.
 int getMaxTableNameLength()
          What is the maximum length of a table name? This was found from pg_class.relname length
 int getMaxTablesInSelect()
          What is the maximum number of tables that can be specified in a SELECT? Theoretically, this is the same number as the number of tables allowable.
 int getMaxUserNameLength()
          What is the maximum length of a user name? Well, we generally use UNIX like user names in PostgreSQL, so I think this would be 8.
 java.lang.String getNumericFunctions()
          This method returns a comma separated list of math functions.
 java.sql.ResultSet getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a table's primary key columns.
 java.sql.ResultSet getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern)
          Get a description of a catalog's stored procedure parameters and result columns.
 java.sql.ResultSet getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern)
          Get a description of stored procedures available in a catalog
 java.lang.String getProcedureTerm()
          What is the database vendor's preferred term for "procedure" - I kind of like "Procedure" myself.
 java.sql.ResultSet getSchemas()
          Get the schema names available in this database.
 java.lang.String getSchemaTerm()
          What is the database vendor's preferred term for "schema" - well, we do not provide support for schemas, so lets just use that term.
 java.lang.String getSearchStringEscape()
          This is the string that can be used to escape '_' and '%' in a search string pattern style catalog search parameters
 java.lang.String getSQLKeywords()
          Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords.
 java.lang.String getStringFunctions()
          This method returns a comma separated list of string functions.
 java.lang.String getSystemFunctions()
          This method returns a comma separated list of of system functions.
 java.sql.ResultSet getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
          Get a description of the access rights for each table available in a catalog.
 java.sql.ResultSet getTables(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String[] types)
          Get a description of tables available in a catalog.
 java.sql.ResultSet getTableTypes()
          Get the table types available in this database.
 java.lang.String getTimeDateFunctions()
          This method returns comma separated list of time/date functions.
 java.sql.ResultSet getTypeInfo()
          Get a description of all the standard SQL types supported by this database.
 java.sql.ResultSet getUDTs(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String typeNamePattern, int[] types)
          This method returns the list of user defined data types in use.
 java.lang.String getURL()
          What is the URL for this database?
 java.lang.String getUserName()
          What is our user name as known to the database?
 java.sql.ResultSet getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Get a description of a table's columns that are automatically updated when any value in a row is updated.
 boolean insertsAreDetected(int type)
          This method tests whether or not the specified result set type can detect a visible insert by calling the rowUpdated method.
 boolean isCatalogAtStart()
          Does a catalog appear at the start of a qualified table name? (Otherwise it appears at the end).
 boolean isReadOnly()
          Is the database in read-only mode?
 boolean nullPlusNonNullIsNull()
          Are concatenations between NULL and non-NULL values NULL? A JDBC Compliant driver always returns true
 boolean nullsAreSortedAtEnd()
          Are NULL values sorted at the end regardless of sort order?
 boolean nullsAreSortedAtStart()
          Are NULL values sorted at the start regardless of sort order?
 boolean nullsAreSortedHigh()
          Are NULL values sorted high?
 boolean nullsAreSortedLow()
          Are NULL values sorted low?
 boolean othersDeletesAreVisible(int i)
          This method tests whether or not the specified result set type sees deletes committed by others.
 boolean othersInsertsAreVisible(int type)
          This method tests whether or not the specified result set type sees inserts committed by others.
 boolean othersUpdatesAreVisible(int type)
          This method tests whether or not the specified result set type sees updates committed by others.
 boolean ownDeletesAreVisible(int type)
          This method tests whether or not the specified result set type sees its own deletes.
 boolean ownInsertsAreVisible(int type)
          This method tests whether or not the specified result set type sees its own inserts.
 boolean ownUpdatesAreVisible(int type)
          This method tests whether or not the specified result set type sees its own updates.
 boolean rowChangesAreDetected(int type)
           
 boolean rowChangesAreVisible(int type)
           
 boolean storesLowerCaseIdentifiers()
          Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in lower case?
 boolean storesLowerCaseQuotedIdentifiers()
          Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in lower case?
 boolean storesMixedCaseIdentifiers()
          Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in mixed case?
 boolean storesMixedCaseQuotedIdentifiers()
          Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in mixed case?
 boolean storesUpperCaseIdentifiers()
          Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in upper case?
 boolean storesUpperCaseQuotedIdentifiers()
          Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in upper case?
 boolean supportsAlterTableWithAddColumn()
          Is "ALTER TABLE" with an add column supported? Yes for PostgreSQL 6.1
 boolean supportsAlterTableWithDropColumn()
          Is "ALTER TABLE" with a drop column supported? Yes for PostgreSQL 6.1
 boolean supportsANSI92EntryLevelSQL()
          Does this driver support the ANSI-92 entry level SQL grammar? All JDBC Compliant drivers must return true.
 boolean supportsANSI92FullSQL()
          Does this driver support the ANSI-92 full SQL grammar?
 boolean supportsANSI92IntermediateSQL()
          Does this driver support the ANSI-92 intermediate level SQL grammar? Anyone who does not support Entry level cannot support Intermediate level.
 boolean supportsBatchUpdates()
          This method tests whether or not the database supports batch updates.
 boolean supportsCatalogsInDataManipulation()
          Can a catalog name be used in a data manipulation statement?
 boolean supportsCatalogsInIndexDefinitions()
          Can a catalog name be used in an index definition?
 boolean supportsCatalogsInPrivilegeDefinitions()
          Can a catalog name be used in a privilege definition statement?
 boolean supportsCatalogsInProcedureCalls()
          Can a catalog name be used in a procedure call statement?
 boolean supportsCatalogsInTableDefinitions()
          Can a catalog name be used in a table definition statement?
 boolean supportsColumnAliasing()
          Is column aliasing supported?
 boolean supportsConvert()
          Tests whether or not CONVERT is supported.
 boolean supportsConvert(int fromType, int toType)
          This method tests whether or not CONVERT can be performed between the specified types.
 boolean supportsCoreSQLGrammar()
          Does this driver support the Core ODBC SQL grammar.
 boolean supportsCorrelatedSubqueries()
          This method test whether or not correlated subqueries are allowed.
 boolean supportsDataDefinitionAndDataManipulationTransactions()
          Are both data definition and data manipulation transactions supported? I checked it, and could not do a CREATE TABLE within a transaction, so I am assuming that we don't
 boolean supportsDataManipulationTransactionsOnly()
          Are only data manipulation statements withing a transaction supported?
 boolean supportsDifferentTableCorrelationNames()
          This method tests whether correlation names must be different from the name of the table.
 boolean supportsExpressionsInOrderBy()
          Are expressions in "ORCER BY" lists supported?
e.g.
 boolean supportsExtendedSQLGrammar()
          Does this driver support the Extended (Level 2) ODBC SQL grammar.
 boolean supportsFullOuterJoins()
          Are full nexted outer joins supported? Well, we dont support any form of outer join, so this is no as well
 boolean supportsGroupBy()
          Is some form of "GROUP BY" clause supported? I checked it, and yes it is.
 boolean supportsGroupByBeyondSelect()
          Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in the SELECT? Does anyone actually understand what they mean here?
 boolean supportsGroupByUnrelated()
          Can a "GROUP BY" clause use columns not in the SELECT? I checked it - it seems to allow it
 boolean supportsIntegrityEnhancementFacility()
          Is the SQL Integrity Enhancement Facility supported? I haven't seen this mentioned anywhere, so I guess not
 boolean supportsLikeEscapeClause()
          Is the escape character in "LIKE" clauses supported? A JDBC compliant driver always returns true.
 boolean supportsLimitedOuterJoins()
          Is there limited support for outer joins? (This will be true if supportFullOuterJoins is true)
 boolean supportsMinimumSQLGrammar()
          Does this driver support the minimum ODBC SQL grammar.
 boolean supportsMixedCaseIdentifiers()
          Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return false.
 boolean supportsMixedCaseQuotedIdentifiers()
          Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC compliant driver will always return true.
 boolean supportsMultipleResultSets()
          Are multiple ResultSets from a single execute supported? Well, I implemented it, but I dont think this is possible from the back ends point of view.
 boolean supportsMultipleTransactions()
          Can we have multiple transactions open at once (on different connections?) I guess we can have, since Im relying on it.
 boolean supportsNonNullableColumns()
          Can columns be defined as non-nullable.
 boolean supportsOpenCursorsAcrossCommit()
          In PostgreSQL, Cursors are only open within transactions.
 boolean supportsOpenCursorsAcrossRollback()
          Do we support open cursors across multiple transactions?
 boolean supportsOpenStatementsAcrossCommit()
          Can statements remain open across commits? They may, but this driver cannot guarentee that.
 boolean supportsOpenStatementsAcrossRollback()
          Can statements remain open across rollbacks? They may, but this driver cannot guarentee that.
 boolean supportsOrderByUnrelated()
          Can an "ORDER BY" clause use columns not in the SELECT? I checked it, and you can't.
 boolean supportsOuterJoins()
          Is some form of outer join supported? From my knowledge, nope.
 boolean supportsPositionedDelete()
          We support cursors for gets only it seems.
 boolean supportsPositionedUpdate()
          Is positioned UPDATE supported?
 boolean supportsResultSetConcurrency(int type, int concurrency)
          This method tests whether the specified result set type and result set concurrency type are supported by the database.
 boolean supportsResultSetType(int type)
          This method tests whether or not the datbase supports the specified result type.
 boolean supportsSchemasInDataManipulation()
          Can a schema name be used in a data manipulation statement? Nope.
 boolean supportsSchemasInIndexDefinitions()
          Can a schema name be used in an index definition statement?
 boolean supportsSchemasInPrivilegeDefinitions()
          Can a schema name be used in a privilege definition statement?
 boolean supportsSchemasInProcedureCalls()
          Can a schema name be used in a procedure call statement? Nope.
 boolean supportsSchemasInTableDefinitions()
          Can a schema be used in a table definition statement? Nope.
 boolean supportsSelectForUpdate()
          This method tests whether or not SELECT FOR UPDATE is supported by the database.
 boolean supportsStoredProcedures()
          This method tests whether or not stored procedures are supported on this database.
 boolean supportsSubqueriesInComparisons()
          This method tests whether or not subqueries are allowed in comparisons.
 boolean supportsSubqueriesInExists()
          This method tests whether or not subqueries are allowed in exists expressions.
 boolean supportsSubqueriesInIns()
          This method tests whether subqueries are allowed in IN statements.
 boolean supportsSubqueriesInQuantifieds()
          This method tests whether or not subqueries are allowed in quantified expressions.
 boolean supportsTableCorrelationNames()
          This method tests whether or not table correlation names are supported.
 boolean supportsTransactionIsolationLevel(int level)
          Does the database support the given transaction isolation level? We only support TRANSACTION_SERIALIZABLE and TRANSACTION_READ_COMMITTED
 boolean supportsTransactions()
          Are transactions supported? If not, commit and rollback are noops and the isolation level is TRANSACTION_NONE.
 boolean supportsUnion()
          Is SQL UNION supported? Nope.
 boolean supportsUnionAll()
          Is SQL UNION ALL supported? Nope.
 boolean updatesAreDetected(int type)
          This method tests whether or not the specified result set type can detect a visible update by calling the rowUpdated method.
 boolean usesLocalFilePerTable()
          Does the database use a file for each table? Well, not really, since it doesnt use local files.
 boolean usesLocalFiles()
          Does the database store tables in a local file? No - it stores them in a file on the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.DatabaseMetaData
getAttributes, getDatabaseMajorVersion, getDatabaseMinorVersion, getJDBCMajorVersion, getJDBCMinorVersion, getResultSetHoldability, getSQLStateType, getSuperTables, getSuperTypes, locatorsUpdateCopy, supportsGetGeneratedKeys, supportsMultipleOpenResults, supportsNamedParameters, supportsResultSetHoldability, supportsSavepoints, supportsStatementPooling
 

Field Detail

connection

Connection connection

iVarcharOid

static final int iVarcharOid
See Also:
Constant Field Values

iBoolOid

static final int iBoolOid
See Also:
Constant Field Values

iInt2Oid

static final int iInt2Oid
See Also:
Constant Field Values

iInt4Oid

static final int iInt4Oid
See Also:
Constant Field Values

VARHDRSZ

static final int VARHDRSZ
See Also:
Constant Field Values

defaultRemarks

private static final byte[] defaultRemarks

getTableTypes

private static final java.lang.String[][] getTableTypes

defaultTableTypes

private static final java.lang.String[] defaultTableTypes
Constructor Detail

DatabaseMetaData

public DatabaseMetaData(Connection conn)
Method Detail

allProceduresAreCallable

public boolean allProceduresAreCallable()
                                 throws java.sql.SQLException
Can all the procedures returned by getProcedures be called by the current user?

Specified by:
allProceduresAreCallable in interface java.sql.DatabaseMetaData

allTablesAreSelectable

public boolean allTablesAreSelectable()
                               throws java.sql.SQLException
Can all the tables returned by getTable be SELECTed by the current user?

Specified by:
allTablesAreSelectable in interface java.sql.DatabaseMetaData

getURL

public java.lang.String getURL()
                        throws java.sql.SQLException
What is the URL for this database?

Specified by:
getURL in interface java.sql.DatabaseMetaData

getUserName

public java.lang.String getUserName()
                             throws java.sql.SQLException
What is our user name as known to the database?

Specified by:
getUserName in interface java.sql.DatabaseMetaData

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Is the database in read-only mode?

Specified by:
isReadOnly in interface java.sql.DatabaseMetaData

nullsAreSortedHigh

public boolean nullsAreSortedHigh()
                           throws java.sql.SQLException
Are NULL values sorted high?

Specified by:
nullsAreSortedHigh in interface java.sql.DatabaseMetaData

nullsAreSortedLow

public boolean nullsAreSortedLow()
                          throws java.sql.SQLException
Are NULL values sorted low?

Specified by:
nullsAreSortedLow in interface java.sql.DatabaseMetaData

nullsAreSortedAtStart

public boolean nullsAreSortedAtStart()
                              throws java.sql.SQLException
Are NULL values sorted at the start regardless of sort order?

Specified by:
nullsAreSortedAtStart in interface java.sql.DatabaseMetaData

nullsAreSortedAtEnd

public boolean nullsAreSortedAtEnd()
                            throws java.sql.SQLException
Are NULL values sorted at the end regardless of sort order?

Specified by:
nullsAreSortedAtEnd in interface java.sql.DatabaseMetaData

getDatabaseProductName

public java.lang.String getDatabaseProductName()
                                        throws java.sql.SQLException
What is the name of this database product - we hope that it is PostgreSQL, so we return that explicitly.

Specified by:
getDatabaseProductName in interface java.sql.DatabaseMetaData

getDatabaseProductVersion

public java.lang.String getDatabaseProductVersion()
                                           throws java.sql.SQLException
What is the version of this database product.

Note that PostgreSQL 6.3 has a system catalog called pg_version - however, select * from pg_version on any database retrieves no rows.

For now, we will return the version 6.3 (in the hope that we change this driver as often as we change the database)

Specified by:
getDatabaseProductVersion in interface java.sql.DatabaseMetaData

getDriverName

public java.lang.String getDriverName()
                               throws java.sql.SQLException
What is the name of this JDBC driver? If we don't know this we are doing something wrong!

Specified by:
getDriverName in interface java.sql.DatabaseMetaData

getDriverVersion

public java.lang.String getDriverVersion()
                                  throws java.sql.SQLException
What is the version string of this JDBC driver? Again, this is static.

Specified by:
getDriverVersion in interface java.sql.DatabaseMetaData

getDriverMajorVersion

public int getDriverMajorVersion()
What is this JDBC driver's major version number?

Specified by:
getDriverMajorVersion in interface java.sql.DatabaseMetaData

getDriverMinorVersion

public int getDriverMinorVersion()
What is this JDBC driver's minor version number?

Specified by:
getDriverMinorVersion in interface java.sql.DatabaseMetaData

usesLocalFiles

public boolean usesLocalFiles()
                       throws java.sql.SQLException
Does the database store tables in a local file? No - it stores them in a file on the server.

Specified by:
usesLocalFiles in interface java.sql.DatabaseMetaData

usesLocalFilePerTable

public boolean usesLocalFilePerTable()
                              throws java.sql.SQLException
Does the database use a file for each table? Well, not really, since it doesnt use local files.

Specified by:
usesLocalFilePerTable in interface java.sql.DatabaseMetaData

supportsMixedCaseIdentifiers

public boolean supportsMixedCaseIdentifiers()
                                     throws java.sql.SQLException
Does the database treat mixed case unquoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC-Compliant driver will always return false.

Predicament - what do they mean by "SQL identifiers" - if it means the names of the tables and columns, then the answers given below are correct - otherwise I don't know.

Specified by:
supportsMixedCaseIdentifiers in interface java.sql.DatabaseMetaData

storesUpperCaseIdentifiers

public boolean storesUpperCaseIdentifiers()
                                   throws java.sql.SQLException
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in upper case?

Specified by:
storesUpperCaseIdentifiers in interface java.sql.DatabaseMetaData

storesLowerCaseIdentifiers

public boolean storesLowerCaseIdentifiers()
                                   throws java.sql.SQLException
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in lower case?

Specified by:
storesLowerCaseIdentifiers in interface java.sql.DatabaseMetaData

storesMixedCaseIdentifiers

public boolean storesMixedCaseIdentifiers()
                                   throws java.sql.SQLException
Does the database treat mixed case unquoted SQL identifiers as case insensitive and store them in mixed case?

Specified by:
storesMixedCaseIdentifiers in interface java.sql.DatabaseMetaData

supportsMixedCaseQuotedIdentifiers

public boolean supportsMixedCaseQuotedIdentifiers()
                                           throws java.sql.SQLException
Does the database treat mixed case quoted SQL identifiers as case sensitive and as a result store them in mixed case? A JDBC compliant driver will always return true.

Predicament - what do they mean by "SQL identifiers" - if it means the names of the tables and columns, then the answers given below are correct - otherwise I don't know.

Specified by:
supportsMixedCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData

storesUpperCaseQuotedIdentifiers

public boolean storesUpperCaseQuotedIdentifiers()
                                         throws java.sql.SQLException
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in upper case?

Specified by:
storesUpperCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData

storesLowerCaseQuotedIdentifiers

public boolean storesLowerCaseQuotedIdentifiers()
                                         throws java.sql.SQLException
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in lower case?

Specified by:
storesLowerCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData

storesMixedCaseQuotedIdentifiers

public boolean storesMixedCaseQuotedIdentifiers()
                                         throws java.sql.SQLException
Does the database treat mixed case quoted SQL identifiers as case insensitive and store them in mixed case?

Specified by:
storesMixedCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
                                          throws java.sql.SQLException
What is the string used to quote SQL identifiers? This returns a space if identifier quoting isn't supported. A JDBC Compliant driver will always use a double quote character.

If an SQL identifier is a table name, column name, etc. then we do not support it.

Specified by:
getIdentifierQuoteString in interface java.sql.DatabaseMetaData

getSQLKeywords

public java.lang.String getSQLKeywords()
                                throws java.sql.SQLException
Get a comma separated list of all a database's SQL keywords that are NOT also SQL92 keywords.

Within PostgreSQL, the keywords are found in src/backend/parser/keywords.c

For SQL Keywords, I took the list provided at http://web.dementia.org/~shadow/sql/sql3bnf.sep93.txt which is for SQL3, not SQL-92, but it is close enough for this purpose.

Specified by:
getSQLKeywords in interface java.sql.DatabaseMetaData

getNumericFunctions

public java.lang.String getNumericFunctions()
                                     throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns a comma separated list of math functions.

Specified by:
getNumericFunctions in interface java.sql.DatabaseMetaData

getStringFunctions

public java.lang.String getStringFunctions()
                                    throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns a comma separated list of string functions.

Specified by:
getStringFunctions in interface java.sql.DatabaseMetaData

getSystemFunctions

public java.lang.String getSystemFunctions()
                                    throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns a comma separated list of of system functions.

Specified by:
getSystemFunctions in interface java.sql.DatabaseMetaData

getTimeDateFunctions

public java.lang.String getTimeDateFunctions()
                                      throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method returns comma separated list of time/date functions.

Specified by:
getTimeDateFunctions in interface java.sql.DatabaseMetaData

getSearchStringEscape

public java.lang.String getSearchStringEscape()
                                       throws java.sql.SQLException
This is the string that can be used to escape '_' and '%' in a search string pattern style catalog search parameters

Specified by:
getSearchStringEscape in interface java.sql.DatabaseMetaData

getExtraNameCharacters

public java.lang.String getExtraNameCharacters()
                                        throws java.sql.SQLException
Get all the "extra" characters that can bew used in unquoted identifier names (those beyond a-zA-Z0-9 and _)

From the file src/backend/parser/scan.l, an identifier is {letter}{letter_or_digit} which makes it just those listed above.

Specified by:
getExtraNameCharacters in interface java.sql.DatabaseMetaData

supportsAlterTableWithAddColumn

public boolean supportsAlterTableWithAddColumn()
                                        throws java.sql.SQLException
Is "ALTER TABLE" with an add column supported? Yes for PostgreSQL 6.1

Specified by:
supportsAlterTableWithAddColumn in interface java.sql.DatabaseMetaData

supportsAlterTableWithDropColumn

public boolean supportsAlterTableWithDropColumn()
                                         throws java.sql.SQLException
Is "ALTER TABLE" with a drop column supported? Yes for PostgreSQL 6.1

Specified by:
supportsAlterTableWithDropColumn in interface java.sql.DatabaseMetaData

supportsColumnAliasing

public boolean supportsColumnAliasing()
                               throws java.sql.SQLException
Is column aliasing supported?

If so, the SQL AS clause can be used to provide names for computed columns or to provide alias names for columns as required. A JDBC Compliant driver always returns true.

e.g.

 select count(C) as C_COUNT from T group by C;

 

should return a column named as C_COUNT instead of count(C)

Specified by:
supportsColumnAliasing in interface java.sql.DatabaseMetaData

nullPlusNonNullIsNull

public boolean nullPlusNonNullIsNull()
                              throws java.sql.SQLException
Are concatenations between NULL and non-NULL values NULL? A JDBC Compliant driver always returns true

Specified by:
nullPlusNonNullIsNull in interface java.sql.DatabaseMetaData

supportsConvert

public boolean supportsConvert()
                        throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
Tests whether or not CONVERT is supported.

Specified by:
supportsConvert in interface java.sql.DatabaseMetaData

supportsConvert

public boolean supportsConvert(int fromType,
                               int toType)
                        throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method tests whether or not CONVERT can be performed between the specified types. The types are contants from Types.

Specified by:
supportsConvert in interface java.sql.DatabaseMetaData

supportsTableCorrelationNames

public boolean supportsTableCorrelationNames()
                                      throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method tests whether or not table correlation names are supported. This will be always be true in a fully JDBC compliant driver.

Specified by:
supportsTableCorrelationNames in interface java.sql.DatabaseMetaData

supportsDifferentTableCorrelationNames

public boolean supportsDifferentTableCorrelationNames()
                                               throws java.sql.SQLException
Description copied from interface: java.sql.DatabaseMetaData
This method tests whether correlation names must be different from the name of the table.

Specified by:
supportsDifferentTableCorrelationNames in interface java.sql.DatabaseMetaData

supportsExpressionsInOrderBy

public boolean supportsExpressionsInOrderBy()
                                     throws java.sql.SQLException
Are expressions in "ORCER BY" lists supported?
e.g. select * from t order by a + b;

Specified by:
supportsExpressionsInOrderBy in interface java.sql.DatabaseMetaData

supportsOrderByUnrelated

public boolean supportsOrderByUnrelated()
                                 throws java.sql.SQLException
Can an "ORDER BY" clause use columns not in the SELECT? I checked it, and you can't.

Specified by:
supportsOrderByUnrelated in interface java.sql.DatabaseMetaData

supportsGroupBy

public boolean supportsGroupBy()
                        throws java.sql.SQLException
Is some form of "GROUP BY" clause supported? I checked it, and yes it is.

Specified by:
supportsGroupBy in interface java.sql.DatabaseMetaData

supportsGroupByUnrelated

public boolean supportsGroupByUnrelated()
                                 throws java.sql.SQLException
Can a "GROUP BY" clause use columns not in the SELECT? I checked it - it seems to allow it

Specified by:
supportsGroupByUnrelated in interface java.sql.DatabaseMetaData

supportsGroupByBeyondSelect

public boolean supportsGroupByBeyondSelect()
                                    throws java.sql.SQLException
Can a "GROUP BY" clause add columns not in the SELECT provided it specifies all the columns in the SELECT? Does anyone actually understand what they mean here?

Specified by:
supportsGroupByBeyondSelect in interface java.sql.DatabaseMetaData

supportsLikeEscapeClause

public boolean supportsLikeEscapeClause()
                                 throws java.sql.SQLException
Is the escape character in "LIKE" clauses supported? A JDBC compliant driver always returns true.

Specified by:
supportsLikeEscapeClause in interface java.sql.DatabaseMetaData