Skip to content

Postgresql 17 & jsonb error #897

@Erwane

Description

@Erwane

Hi, i'm trying to create migration with jsonb type but this result in an error

$this->table('issues')
    ->addColumn('permissions', AdapterInterface::PHINX_TYPE_JSONB)
    ->create();

psql log

2025-08-20T21:10:57.488030971Z 2025-08-20 21:10:57.487 UTC [38] ERROR:  syntax error at or near "NOT" at character 69
2025-08-20T21:10:57.488066611Z 2025-08-20 21:10:57.487 UTC [38] STATEMENT:  CREATE TABLE "public"."issues" ("id" SERIAL NOT NULL, "permissions" NOT NULL, CONSTRAINT "issues_pkey" PRIMARY KEY ("id"));

It's look like the field permissions has no type.

$this->table('issues')
    ->addColumn('permissions', AdapterInterface::PHINX_TYPE_JSON)
    ->create();

with PHINX_TYPE_JSON, it's ok and create ... a jsonb field ... :-/

vendor/bin/phinx --version
Phinx by CakePHP - https://phinx.org. 0.16.10

php -v
PHP 8.4.11 (cli) (built: Aug  3 2025 08:49:56) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.11, Copyright (c), by Zend Technologies
    with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions