Skip to content

Commit b531ccd

Browse files
committed
use parse_ident
1 parent be0d281 commit b531ccd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Pgsql/PgsqlDriver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ public function getTableColumns($table, $typeOnly = true)
229229
$result = [];
230230
$tableSub = $this->replacePrefix($table);
231231

232-
$fullname = explode('.', $tableSub);
232+
if (strpos($tableSub, '.') !== false) {
233+
$this->setQuery("select array_to_json(parse_ident('$tableSub', true)::NAME[])");
234+
$fullname = json_decode($this->loadRow()[0]);
235+
}
233236

234-
if (is_array($fullname) && count($fullname) == 2)
235-
{
237+
if (is_array($fullname) && count($fullname) == 2) {
236238
$tableSub = $fullname[1];
237239
$defaultSchema = $fullname[0];
238-
}
239-
else
240-
{
240+
} else {
241241
$defaultSchema = $this->getDefaultSchema();
242242
}
243243

0 commit comments

Comments
 (0)