Postgresql json operators
After a fresh install and composer update it's not possible to retrieve index page and admin page because "=" operator on json column in sql query does not exist
Details
| Relevant Bolt Version | 4.0 | Install type | Composer install | BC Break | yes (documentation talk about postgresql support) | PHP version | 7.3 (docker-compose provided) | Web server | Nginx [docker-compose provided]
Reproduction
composer create-project bolt/project myproject
sample of docker-compose.yml
database:
image: postgres:12-alpine
env_file:
- .env
environment:
- POSTGRES_DB=${DATABASE_NAME}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
- POSTGRES_USER=${DATABASE_USER}
volumes:
- db-data:/var/lib/postgresql/data:rw
ports:
- target: 5432
published: 5432
protocol: tcp
php/Dockerfile
...
RUN extBuildDeps=" \
...
libpq-dev \
"; \
...
docker-php-ext-install \
...
pdo_pgsql \
...
config/packages/doctrine.yaml
parameters:
# Adds a fallback DATABASE_URL if the env var is not set. This allows you
# to run cache:warmup even if your environment variables are not available
# yet. You should not need to change this value.
env(DATABASE_DRIVER): 'pdo_pgsql'
env(DATABASE_URL): ''
doctrine:
dbal:
charset: utf8
url: '%env(resolve:DATABASE_URL)%'
driver: '%env(resolve:DATABASE_DRIVER)%'
Launch containers
docker-compose up -d
Setup
docker-compose exec php bin/console bolt:setup
# with fixtures
Bug summary
Operator "=" on json column in sql query does not exist on Postgres
Specifics
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: json = unknown
LINE 1: ..._ ON b1_.id = b3_.translatable_id WHERE b3_.value = $1 AND b...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
Expected result
Welcome page
Actual result
Error page
Thanks for the write-up! Postgres needs some love to work optimally, obviously. We'll work on it.
For now, you could use MySQL (or MariaDB) or SQLite. Both work just fine.
Just to keep track of this:
https://github.com/milosa/core/tree/postgresql
https://github.com/bolt/core/compare/master...milosa:postgresql
Thanks for the write-up! Postgres needs some love to work optimally, obviously. We'll work on it.
For now, you could use MySQL (or MariaDB) or SQLite. Both work just fine.
In case someone is interested to try it out, I got it working on FreeBSD with PostgreSQL 11.6. https://github.com/Wieter/core/tree/development-postgres (No problems found as of yet, only the search function is back to case-sensitive)
@Wieter That looks interesting! If you think it's good-to-go, please make a PR for it! :-)
This is fixed by #1933 :-D