Skip to content

Instantly share code, notes, and snippets.

@moertel
Last active September 20, 2019 08:20
Show Gist options
  • Save moertel/08cc6a72b913990853f131bb4739f35c to your computer and use it in GitHub Desktop.
Save moertel/08cc6a72b913990853f131bb4739f35c to your computer and use it in GitHub Desktop.
cstore_fdw: ERROR: cache lookup failed for type 0 (Steps to reproduce)
FROM postgres:9.6.9
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
curl \
apt-transport-https \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl --silent --show-error --fail 'https://repos.citusdata.com/community/config_file.list?os=debian&dist=stretch&source=script' > /etc/apt/sources.list.d/citusdata_community.list \
&& curl --silent --location-trusted https://repos.citusdata.com/community/gpgkey | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \
&& apt-get update && apt-get install -y \
postgresql-9.6-cstore-fdw \
&& apt-get purge -y --auto-remove curl && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN echo "create extension if not exists cstore_fdw;" > /docker-entrypoint-initdb.d/init.sql
RUN echo "create server cstore_server foreign data wrapper cstore_fdw;" >> /docker-entrypoint-initdb.d/init.sql
RUN echo "shared_preload_libraries = 'cstore_fdw'" >> $PGDATA/pg_hba.conf
create foreign table t1 (id int, id2 int) server cstore_server options (compression 'pglz');
insert into t1 select 1, 2;
alter table t1 drop column id2;
select count(t1.*) from t1;
select version();
/**
version
------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.9 on x86_64-pc-linux-gnu (Debian 9.6.9-2.pgdg90+1), compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)
*/
select * from pg_available_extensions where name = 'cstore_fdw';
/**
name | default_version | installed_version | comment
------------+-----------------+-------------------+---------------------------------------------
cstore_fdw | 1.6 | 1.6 | foreign-data wrapper for flat cstore access
(1 row)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment