Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Documentation should specify supported PostgreSQL versions (i.e. 9.5+) #8

Closed
pdecat opened this issue Jun 28, 2017 · 1 comment
Closed
Assignees

Comments

@pdecat
Copy link

pdecat commented Jun 28, 2017

The current PostgreSQL terraform provider depends on features only available with PostgreSQL versions 9.5+ such as row-level security.

This should be specified in the provider's documentation as it is not compatible with 9.4.x and earlier versions of PostgreSQL.

https://www.postgresql.org/docs/9.5/static/ddl-rowsecurity.html
https://wiki.postgresql.org/wiki/Row-security
https://www.postgresql.org/docs/9.5/static/release-9-5.html#AEN128103

Specifically, the code refers to the rolbypassrls column which does not exist on 9.4.x and earlier versions of PostgreSQL:

	var roleSuperuser, roleInherit, roleCreateRole, roleCreateDB, roleCanLogin, roleReplication, roleBypassRLS bool
	var roleConnLimit int
	var roleName, roleValidUntil string
	err = conn.QueryRow("SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolconnlimit, COALESCE(rolvaliduntil::TEXT, 'infinity'), rolbypassrls FROM pg_catalog.pg_roles WHERE rolname=$1", roleId).Scan(&roleName, &roleSuperuser, &roleInherit, &roleCreateRole, &roleCreateDB, &roleCanLogin, &roleReplication, &roleConnLimit, &roleValidUntil, &roleBypassRLS)

cf. https://github.com/terraform-providers/terraform-provider-postgresql/blob/v0.1.0/postgresql/resource_postgresql_role.go#L345

Trying to query this column fails on PostgreSQL 9.4.9:

# psql -h myhost -U myuser -d mydb
psql (9.6.1, server 9.4.9)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

mydb=> SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolconnlimit, COALESCE(rolvaliduntil::TEXT, 'infinity'), rolbypassrls FROM pg_catalog.pg_roles WHERE rolname='mr_readonly';
ERROR:  column "rolbypassrls" does not exist
LINE 1: ...limit, COALESCE(rolvaliduntil::TEXT, 'infinity'), rolbypassr...
                                                             ^
mydb=> SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolconnlimit, COALESCE(rolvaliduntil::TEXT, 'infinity') FROM pg_catalog.pg_roles WHERE rolname='mr_readonly';
   rolname   | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolconnlimit | coalesce
-------------+----------+------------+---------------+-------------+-------------+----------------+--------------+----------
 mr_readonly | f        | t          | f             | f           | f           | f              |           -1 | infinity
(1 row)

oc=>
@sean-
Copy link
Contributor

sean- commented Jul 10, 2017

@pdecat, as soon as #12 lands you'll be in a good spot. This has been a nagging issue for a while.

@sean- sean- self-assigned this Jul 10, 2017
@sean- sean- closed this as completed in e0b6363 Jul 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants