\connect postgres CREATE SCHEMA analytic_results; CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA analytic_results; ALTER DATABASE postgres OWNER TO usr; UPDATE pg_extension SET extrelocatable = TRUE WHERE extname = 'postgis'; ALTER EXTENSION postgis SET SCHEMA analytic_results; ALTER DATABASE postgres SET search_path = public, analytic_results, postgis; GRANT ALL ON SCHEMA analytic_results TO usr; GRANT ALL ON SCHEMA public TO usr; GRANT ALL PRIVILEGES ON DATABASE postgres TO usr; GRANT ALL ON ALL TABLES IN SCHEMA analytic_results TO usr; GRANT ALL PRIVILEGES ON DATABASE postgres TO usr; \disconnect \connect postgres CREATE TABLE analytic_results."trevor-table" ( fid INTEGER, geom geometry(point), timestamp TIMESTAMP);
Hi everyone! Is there an easy way of adding/enabling postgis in my postgres10 dockerfile?
This is my dockerfile:
FROM postgres:10.4 COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance RUN chmod +x /usr/local/bin/maintenance/* RUN mv /usr/local/bin/maintenance/* /usr/local/bin \ && rmdir /usr/local/bin/maintenance
I tried to add:
RUN apt-get update && \ apt-get -y install sudo RUN service postgresql start \ && sudo -u postgres psql -c "CREATE EXTENSION postgis;" RUN service postgresql stop
but I get the error:
psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
But I am not sure if that is even the way to go. Has anyone done this before? Thanks is advance!!
Hi :-) I've created a container from image
postgis/postgis:12-3.0 and tried to apply German language settings:
environment: POSTGRES_USER: bop POSTGRES_PASS: mypass POSTGRES_DBNAME: pgis DEFAULT_COLLATION: de_DE.UTF-8 DEFAULT_CTYPE: de_DE.UTF-8 DEFAULT_ENCODIG: UTF8
But the database is created with ctype and collation
C.UTF-8. Did I make a mistake ?
chown postgres:postgres /home/postgres/.pgpassand
chmod 0600 /home/postgres/.pgpassbut when the container starts up it still says the password is unset
CREATE EXTENSION address_standardizerthat is fine, but then try to access and it says the function
pagc_normalize_addressare not found. The user I am logged in is a superuser (not the default
postgresuser), but if I login as the
postgresuser, the functions are available and work fine. I'm not clear on the permissions structure for this extension. Can someone advise?
Can someone help me understand how this is happening? ```posapi=# select * from parse_address('');
num | street | street2 | address1 | city | state | zip | zipplus | country
| | | | | | | | US
posapi=# select from normalize_address('');
ERROR: function normalize_address(unknown) does not exist
LINE 1: select from normalize_address('');
HINT: No function matches the given name and argument types. You might need to add explicit type casts.```
address_standardizermust be created by the same user that will be using it. Also, it depends on
postgis_tiger_geocoderand if that extension is not also installed, it will just fail by saying the function doesn't exist. I had to trial/error several docker image builds to figure this out. Let me know if you would accept a PR on improving documentation around this because I lost several hours this week having this fail on us.
psycopg2.errors.DiskFull: could not resize shared memory segment "/PostgreSQL.550616896" to 8388608 bytes: No space left on device