From 7d5e5fb23748281dbdb3ac38e0fc9886ddf8828f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 22 Sep 2016 15:18:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bpgsql=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=A9=B1=E5=8A=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E8=A1=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=A1=E6=81=AF=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/connector/Pgsql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/db/connector/Pgsql.php b/library/think/db/connector/Pgsql.php index 6d653c14..e9866cf3 100644 --- a/library/think/db/connector/Pgsql.php +++ b/library/think/db/connector/Pgsql.php @@ -59,10 +59,10 @@ class Pgsql extends Connection $info[$val['field']] = [ 'name' => $val['field'], 'type' => $val['type'], - 'notnull' => (bool) ('' === $val['null']), // not null is empty, null is yes + 'notnull' => (bool) ('' !== $val['null']), 'default' => $val['default'], - 'primary' => (strtolower($val['key']) == 'pri'), - 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), + 'primary' => !empty($val['key']), + 'autoinc' => (0 === strpos($val['extra'], 'nextval(')), ]; } }