Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omego/db.py is sensitive to .psqlrc settings #105

Open
joshmoore opened this issue Jun 14, 2017 · 1 comment
Open

omego/db.py is sensitive to .psqlrc settings #105

joshmoore opened this issue Jun 14, 2017 · 1 comment

Comments

@joshmoore
Copy link
Member

joshmoore commented Jun 14, 2017

In my ~/.psqlrc file I have

\pset linestyle unicode
\timing

which leads to this:

2017-06-14 22:10:43,928 [    omego.db] DEBUG stdout: Timing is on.
Line style is unicode.
OMERO4.4|0
Time: 1.400 ms

Traceback (most recent call last):
  File "/opt/v/bin/omego", line 9, in <module>
    load_entry_point('omego==0.4.0', 'console_scripts', 'omego')()
  File "/opt/v/lib/python2.7/site-packages/omego/main.py", line 52, in entry_point
    (Version.NAME, Version)])
  File "/opt/v/lib/python2.7/site-packages/yaclifw/framework.py", line 197, in main
    ns.func(ns)
  File "/opt/v/lib/python2.7/site-packages/omego/upgrade.py", line 415, in __call__
    UnixInstall(self.NAME, args)
  File "/opt/v/lib/python2.7/site-packages/omego/upgrade.py", line 70, in __init__
    self.upgrade_db()
  File "/opt/v/lib/python2.7/site-packages/omego/upgrade.py", line 205, in upgrade_db
    DbAdmin(self.dir, 'upgrade', self.args, self.external)
  File "/opt/v/lib/python2.7/site-packages/omego/db.py", line 41, in __init__
    getattr(self, command)()
  File "/opt/v/lib/python2.7/site-packages/omego/db.py", line 136, in upgrade
    currentsqlv = '%s__%s' % self.get_current_db_version()
  File "/opt/v/lib/python2.7/site-packages/omego/db.py", line 157, in get_current_db_version
    raise Exception('Got %d rows, expected 1', len(result))
Exception: ('Got %d rows, expected 1', 4)

Found while testing gh-104

@manics
Copy link
Member

manics commented Jun 14, 2017

Looks like the behaviour depends on your PG version:

https://www.postgresql.org/docs/9.4/static/app-psql.html

-c command
--command=command

Specifies that psql is to execute one command string, command, and then exit. This is useful in shell scripts. Start-up files (psqlrc and ~/.psqlrc) are ignored with this option.

https://www.postgresql.org/docs/9.6/static/app-psql.html

-c command
--command=command

Specifies that psql is to execute the given command string, command. This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.

The docs suggest -X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants