Skip to content

Commit daf5187

Browse files
committed
fix: postgres column metadata order
1 parent def66c8 commit daf5187

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

system/Database/Postgre/Connection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ protected function _listColumns(string $table = ''): string
277277
return 'SELECT "column_name"
278278
FROM "information_schema"."columns"
279279
WHERE LOWER("table_name") = '
280-
. $this->escape($this->DBPrefix . strtolower($table));
280+
. $this->escape($this->DBPrefix . strtolower($table))
281+
. ' ORDER BY "ordinal_position"';
281282
}
282283

283284
//--------------------------------------------------------------------
@@ -294,7 +295,8 @@ public function _fieldData(string $table): array
294295
$sql = 'SELECT "column_name", "data_type", "character_maximum_length", "numeric_precision", "column_default"
295296
FROM "information_schema"."columns"
296297
WHERE LOWER("table_name") = '
297-
. $this->escape(strtolower($table));
298+
. $this->escape(strtolower($table))
299+
. ' ORDER BY "ordinal_position"';
298300

299301
if (($query = $this->query($sql)) === false)
300302
{

0 commit comments

Comments
 (0)