Skip to content

Commit 9c509d1

Browse files
author
ipolevoy
committed
#762 Cannot find quoted table in PostgreSQL
1 parent 361b363 commit 9c509d1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

activejdbc/src/main/java/org/javalite/activejdbc/Registry.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ private Map<String, ColumnMetadata> fetchMetaParams(DatabaseMetaData databaseMet
205205
} else if(tableName.startsWith("\"") && tableName.endsWith("\"")) {
206206
tableName = tableName.substring(1, tableName.length() - 1);
207207
}
208+
}
208209

210+
if(dbType.toLowerCase().contains("postgres") && tableName.startsWith("\"") && tableName.endsWith("\"")){
211+
tableName = tableName.substring(1, tableName.length() - 1);
209212
}
210213

211214
ResultSet rs = databaseMetaData.getColumns(catalog, schema, tableName, null);

activejdbc/src/test/java/org/javalite/activejdbc/CaseSensitiveSpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
public class CaseSensitiveSpec extends ActiveJDBCTest {
1313

1414
@Test// see definition of table name for WildAnimal
15-
public void should_pass_with_quotes_spaces_and_CamelCase(){
15+
public void should_pass_with_quotes_spaces_and_CamelCase() {
1616
if(url().contains("postgresql") || url().contains("h2")){ // ATTENTION, this is testing only H2 and PostgreSQL
1717
WildAnimal wildAnimal = new WildAnimal();
1818
wildAnimal.set("\"Name\"", "Cheetah").saveIt();

0 commit comments

Comments
 (0)