postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.39k stars 466 forks source link

ERROR: Input of anonymous composite types is not implemented #158

Closed paunovic closed 4 years ago

paunovic commented 4 years ago

Hey guys, I am using this image to fiddle with GitLab CI/CD implementation. My .gitlab-ci.yml file looks like this:

test:
  image: python:3.7.5
  services:
    - name: mdillon/postgis:11
      alias: postgres
    - name: redis:latest
  script:
    - apt-get update
    - pip install -U pip setuptools
    - pip install -r requirements_dev.txt
    - pytest -x --strict
  variables:
    POSTGRES_DB: testdb
    POSTGRES_USER: xxx
    POSTGRES_PASSWORD: xxx
    PGPASSWORD: xxx
    REDIS_HOST: redis
    REDIS_PORT: 6379

However, once tests start running, I'm getting following error which only happens inside CI/CD pipeline with this image:

statement = 'SELECT users.password AS users_password, users.created_at AS users_created_at, users.updated_at AS users_updated_at, ...ND users.id = user_followers.follows_id AND user_followers.state = %(state_1)s ORDER BY user_followers.updated_at DESC'
parameters = {'param_1': 3, 'state_1': 'yes'}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f8a2dce4490>

    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       sqlalchemy.exc.NotSupportedError: (psycopg2.errors.FeatureNotSupported) input of anonymous composite types is not implemented
E       LINE 3: ...r_followers.follows_id AND user_followers.state = 'yes' ORDE...
E                                                                    ^

Does anyone have an idea about whats going on? It seems to have problems with ENUM PostgreSQL types, but I am not sure on how to debug or fix this. I am not able to reproduce this error outside of the container.

phillipross commented 4 years ago

@paunovic Is this still an issue? Is this PostGIS specific or an issue with official PostgreSQL images as well?

phillipross commented 4 years ago

@paunovic I just wanted to ping you again to see if this is still an issue. With all of the information you've provided thus far, I'm not able to see how the problem you're seeing is related to postgis specifically, and I would try to see if the problem can be replicated with official postgres images which provide the basis for the postgis images. That should help to isolate the problem a little to see if maybe there is some difference.

paunovic commented 4 years ago

Hi, thanks for trying to fix this. I actually abandoned this idea due to the issue above and haven't tried since then, I'll give it another go tomorrow and let you know. I've just tried with your image since it comes with PostGIS preinstalled.

paunovic commented 4 years ago

Hi @phillipross I finally got time to circle back to this again. Now it seems to work, with following pipeline:

test:
  image: python:3.8.1
  services:
    - name: mdillon/postgis:11
      alias: postgres
    - name: redis:latest
  script:
    - apt-get update
    - apt-get -y install libgeos-dev
    - pip install -U pip setuptools
    - pip install -r requirements_dev.txt
    - pytest -x --strict
  variables:
    POSTGRES_DB: xxx
    POSTGRES_USER: xxx
    POSTGRES_PASSWORD: xxx
    PGPASSWORD: xxx
    REDIS_HOST: redis
    REDIS_PORT: 6379

I have no idea why it works now. Did postgis:11 image change? I haven't changed anything in meantime except upgrading my codebase from Python 3.7 to 3.8.

In any case I'm happy this is resolved now!

phillipross commented 4 years ago

The mdillon/postgis:11 image has not changed at all. What has recently changed is that the images are now pushed to postgis/postgis instead of mdillon/postgis so you may want to change to those and test as well. I'm glad it's working for you now, and I'm going to close this issue since you've resolved it.