Tag Info

Hot answers tagged

2

Try an extra layer of quotes around your variables: psql -d mydb -U me -h localhost -f db_log.sql -v db_user_string="'Me'" -v version="'1.7.3'"


1

As suggested by @Josh Kupershmidt and @JoeNahmias the solution is to use UNIQUE on md5 hash of the long value. However PostgreSQL 9.3 doesn't support expressions in UNIQUE constraints so an index, that supports expressions, has to be used: create unique index unique_data_url_index on mytable (md5(data_url));


1

PostgreSQL builds an index to support the UNIQUE constraint. You cannot index a field that large. As @josh-kupershmidt suggested, create the constraint on a hash of the field and you should be alright, barring hash collisions.


1

\c prints something like You are now connected to database "foobar" as user "squanderer". Use this if you don't mind creating a new connection, because this is what happens. The \connect (shortened as \c) without all parameters will create a new connection identical to your current one. The current connection is closed. See the \connect command spec on ...



Only top voted, non community-wiki answers of a minimum length are eligible