Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql json operators #1460

Closed
reminec opened this issue Jun 9, 2020 · 5 comments
Closed

Postgresql json operators #1460

reminec opened this issue Jun 9, 2020 · 5 comments
Labels
🐛 tag: bug This is a bug.

Comments

@reminec
Copy link

reminec commented Jun 9, 2020

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

@bobdenotter
Copy link
Member

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.

@bobdenotter bobdenotter added the 🐛 tag: bug This is a bug. label Jun 10, 2020
@bobdenotter
Copy link
Member

@Wieter
Copy link
Contributor

Wieter commented Sep 29, 2020

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)

@bobdenotter
Copy link
Member

@Wieter That looks interesting! If you think it's good-to-go, please make a PR for it! :-)

@bobdenotter
Copy link
Member

This is fixed by #1933 :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 tag: bug This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants