0

I'm attempting to use pgProvider as part of a move to Postgresql to get membership working in a .NET MVC4 web app, however I keep encountering the following error:

ERROR: 42P01: relation "versions" does not exist

So far I've set up the web.config as suggested and confirmed that the provider is successfully connecting to the database using .NET Reflector. I've narrowed the issue down to the ValidateVersion() function within the DDLManager.cs file in pgProvider.

Essentially what is happening is pgProvider is trying to check if it should auto-create the membership tables (by checking if the tables already exist). However the way in which it does this is by running this query:

select count(*) from pg_tables where schemaname = 'public' and tablename = 'versions';

And then tries to parse the result into an int, returning the bool from int.TryParse() as the indicator of whether the table exists or not. But because the result that is being returned is 0 instead of NULL (which I assume is what pgProvider expects if there is no table), it always evaluates to true...because obviously 0 is an int. Therefore, it thinks all the tables exist and tries to run on a query on the "versions" table which hasn't been created.

So I'm not sure if it's an issue with my database returning 0 when it should return NULL or if it's an issue with pgProvider not actually looking at what is returned. Where should I go from here?

asandhu
  • 21
  • 5

1 Answers1

0

I use pgprovider version 1.8, and experience the same problem.

The solution is to execute some queries manually, before pgprovider can running well. You can check DDLManager.cs function ValidateVersion, execute query manually for region v1.1, v1.2, and v1.3 with similar order. Query files is available in folder pgProvider/ddl.

After you execute the query, pgprovider can run itself for region v1.4 until v1.7.

https://github.com/jholovacs/pgprovider

Chandra S
  • 11
  • 2