Conor
Conor

Reputation: 3579

Running migrations prepends schema public to CREATE statements in structure.sql

When running $ rails db:migrate, regardless if any migrations have been added or not, structure.sql changes removing SET search_path = public, pg_catalog; and replacing it with SELECT pg_catalog.set_config('search_path', '', false); then prepending public. to every CREATE statement.

Example:

CREATE FUNCTION round_minutes(timestamp without time zone, integer) RETURNS timestamp without time zone

Becomes:

CREATE FUNCTION public.round_minutes(timestamp without time zone, integer) RETURNS timestamp without time zone

Using:

The issue appears to affect those of us using Postgres version above 9.6.5

Is there a way to configure Postgres not to do this?

Upvotes: 3

Views: 798

Answers (1)

Reed G. Law
Reed G. Law

Reputation: 3945

There was a vulnerability in Postgresql that was fixed in March, 2018.

If you are using Postgresql version 10.3, 9.6.8, 9.5.12, 9.4.17, 9.3.22, or higher point version then it will specify the public schema in table references and set the pg_catalog search_path.

Perhaps someone on your team is using an older version of Postgresql causing the structure.sql to revert.

Upvotes: 4

Related Questions