Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8363e137
Commit
8363e137
authored
Sep 15, 1999
by
Peter Mount
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jens Glaser found that getPrimaryKeys() had a table called test hardwired
into it.
parent
cd68ecfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
+15
-14
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
+15
-14
No files found.
src/interfaces/jdbc/postgresql/jdbc1/DatabaseMetaData.java
View file @
8363e137
...
@@ -2152,20 +2152,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -2152,20 +2152,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
{
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
" '' as TABLE_CAT,"
+
"'' as TABLE_CAT,"
+
" '' AS TABLE_SCHEM,"
+
"'' AS TABLE_SCHEM,"
+
" bc.relname AS TABLE_NAME,"
+
"bc.relname AS TABLE_NAME,"
+
" a.attname AS COLUMN_NAME,"
+
"a.attname AS COLUMN_NAME,"
+
" a.attnum as KEY_SEQ,"
+
"a.attnum as KEY_SEQ,"
+
" ic.relname as PK_NAME"
+
"ic.relname as PK_NAME "
+
" from pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t"
+
" FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a"
+
" where bc.relkind = 'r'"
+
" WHERE bc.relkind = 'r' "
+
// -- not indices
" and upper(bc.relname) = upper('test')"
+
" and upper(bc.relname) = upper('"
+
table
+
"')"
+
" and i.indrelid = bc.oid"
+
" and i.indrelid = bc.oid"
+
" and i.indexrelid = ic.oid and a.attrelid = ic.oid"
+
" and i.indexrelid = ic.oid"
+
" and i.indisprimary='t'"
+
" and ic.oid = a.attrelid"
+
" order by table_name, pk_name,key_seq;"
" and i.indisprimary='t' "
+
);
" ORDER BY table_name, pk_name, key_seq"
);
}
}
/**
/**
...
...
src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.java
View file @
8363e137
...
@@ -2152,20 +2152,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
...
@@ -2152,20 +2152,21 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
public
java
.
sql
.
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
{
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
return
connection
.
createStatement
().
executeQuery
(
"SELECT "
+
" '' as TABLE_CAT,"
+
"'' as TABLE_CAT,"
+
" '' AS TABLE_SCHEM,"
+
"'' AS TABLE_SCHEM,"
+
" bc.relname AS TABLE_NAME,"
+
"bc.relname AS TABLE_NAME,"
+
" a.attname AS COLUMN_NAME,"
+
"a.attname AS COLUMN_NAME,"
+
" a.attnum as KEY_SEQ,"
+
"a.attnum as KEY_SEQ,"
+
" ic.relname as PK_NAME"
+
"ic.relname as PK_NAME "
+
" from pg_class bc, pg_class ic, pg_index i, pg_attribute a, pg_type t"
+
" FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a"
+
" where bc.relkind = 'r'"
+
" WHERE bc.relkind = 'r' "
+
// -- not indices
" and upper(bc.relname) = upper('test')"
+
" and upper(bc.relname) = upper('"
+
table
+
"')"
+
" and i.indrelid = bc.oid"
+
" and i.indrelid = bc.oid"
+
" and i.indexrelid = ic.oid and a.attrelid = ic.oid"
+
" and i.indexrelid = ic.oid"
+
" and i.indisprimary='t'"
+
" and ic.oid = a.attrelid"
+
" order by table_name, pk_name,key_seq;"
" and i.indisprimary='t' "
+
);
" ORDER BY table_name, pk_name, key_seq"
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment