error creating DB: relation "version" does not exist

    • anblick
      anblick
      Bronze
      Joined: 26.07.2009 Posts: 9
      Due to an unusual setup where I run Windows in a VM, I need Elephant to connect to a remote postgresql instance running on a Linux host. I worked out that it needs a superuser account to set up, and the database encoding to be UTF8, but I'm stuck with the above error. It occurs many times when I attempt to create a new database. Testing the connection works fine.


      OS: Microsoft Windows NT 5.1.2600 Service Pack 3
      .NET Runtime: 2.0.50727.3053
      RAM: 0GB
      Processors: 1
      CPU:
      Software version: 0.69

      (10) Log: 22:10:15.97 -- Logfile set: C:\Documents and Settings\Administrator\Local Settings\Application Data\PokerStrategy\Elephant\log.txt
      (10) Log: 22:10:15.99 -- Logfile cleared: C:\Documents and Settings\Administrator\Local Settings\Application Data\PokerStrategy\Elephant\log.txt
      (10) Log: 22:18:20.81 -- SELECT major::integer, minor::integer FROM version ORDER BY major DESC, minor DESC LIMIT 1
      (10) Log: 22:18:21.04 -- , line 0: Npgsql.NpgsqlException:
      relation "version" does not exist
      Severity: ERROR
      Code: 42P01
      at Npgsql.NpgsqlState.<ProcessBackendResponses_Ver_3>d__a.MoveNext()
      at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject()
      at Npgsql.ForwardsOnlyDataReader.GetNextRowDescription()
      at Npgsql.ForwardsOnlyDataReader.NextResult()
      at Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean synchOnReadError)
      at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)
      at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb)
      at Npgsql.NpgsqlCommand.ExecuteReader()
      at PBN.Database.PostgreSQL.ExecuteQuery(String in_sQuery)
      (10) , line 0: Npgsql.NpgsqlException:
      relation "version" does not exist


      Many similar errors occur for other tables/relations. It looks to me like no CREATE statements ever get issued to Postgresql. Is it possible for me to populate the database in another way so Elephant will be able to find it? Perhaps an SQL script, or a backup of another person's newly-initialised Elephant DB?
  • 2 replies
    • anblick
      anblick
      Bronze
      Joined: 26.07.2009 Posts: 9
      I worked it out in the end .. my postgres template1 database has SQL_ASCII encoding instead of UTF8, as Elephant requires. I can create a UTF8 database myself by specifying a different template, so I was trying to initialise elephant on a new, empty database. This doesn't work, despite the "Test Connection" button's behaviour suggesting otherwise.

      The workaround was to temporarily replace template1 with a new UTF8 database, then let elephant create its own database .. afterwards I moved template1 back. The postgres docs suggest this won't have any ill effects, but I've taken backups just in case :) .

      On a side note: it would be nice if elephant could cope without superuser access to postgres. I'm hoping I can revoke these privileges and it will continue to function.
    • eteris
      eteris
      Bronze
      Joined: 26.08.2007 Posts: 383
      well, I think elephant needs admin rights to create tables and shit, so maybe you can play a little with different users and rights