Recently I switched to Postgres for my Rails database needs. Everything is good, but when running tests I get pages of NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index ...
spewing into my output.
I asked around and got some help from @robtreat2. A quick search lead me to the Postgres docs on the matter.
client_min_messages (string)
Controls which message levels are sent to the client. Valid values areDEBUG5
,DEBUG4
,DEBUG3
,DEBUG2
,DEBUG1
,LOG
,NOTICE
,WARNING
,ERROR
,FATAL
, andPANIC
. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. The default isNOTICE
. Note thatLOG
has a different rank here than inlog_min_messages
.
That’s great for straight Postgres, but I don’t want to have some connection.exec
jimmied into my test environment. Fortunately the Rails docs were also in that same search result:
:min_messages
– An optional client min messages that is used in aSET client_min_messages TO <min_messages>
call on the connection.
Using my newfound knowledge I was able to solve the issue by adding this to my database.yml
file:
test: ... min_messages: WARNING
Just what I needed, thanks a lot for sharing.
LikeLike
Thanks, it helped me out!
b
LikeLike
Whew, +1 here as well. Big thanks.
LikeLike
Nice one, thanks for this
LikeLike
Worked like a charm, thanks!
LikeLike