PgSqlDump

PgSqlDump

Postby damon.cognito » Tue 09 Jun 2015 13:31

Running into two problems with PgSqlDump. First I want to dump the schema, tables and views only but it also includes sequences which I am pretty sure the code below shouldn't:

Code: Select all
                        using (var schemaBackup = new PgSqlDump()
                        {
                            Connection = myConnection.getConnection(),
                            QuoteIdentifier = true,
                            Mode = DumpMode.Schema,
                            GenerateHeader = false,
                            ObjectTypes = PgSqlDumpObjects.Schemas ^ PgSqlDumpObjects.Tables ^ PgSqlDumpObjects.Views
                        })
                        { .... }


Secondly, the sequences have owners set whereas the Tables do not. We are a little behind (7.3.342.0) but not too far.

cheers!
damon.cognito
 
Posts: 50
Joined: Wed 22 Jul 2009 09:30

Re: PgSqlDump

Postby Pinturiccio » Wed 10 Jun 2015 13:28

damon.cognito wrote:First I want to dump the schema, tables and views only but it also includes sequences which I am pretty sure the code below shouldn't:

Your code adds the sequences that are used for table serial columns to a dump file. Other sequences are not added. If you want to add all the sequences, also add PgSqlDumpObjects.Sequences to ObjectTypes.

damon.cognito wrote:ObjectTypes = PgSqlDumpObjects.Schemas ^ PgSqlDumpObjects.Tables ^ PgSqlDumpObjects.Views

Please also note that you use the XOR (^) operator for specifying several PgSqlDumpObjects. This does not cause errors in this example, but this is incorrect and potentially leads to errors in other cases. It's better to use the OR (|) operator for this purpose:
Code: Select all
ObjectTypes = PgSqlDumpObjects.Schemas | PgSqlDumpObjects.Tables | PgSqlDumpObjects.Views


damon.cognito wrote:Secondly, the sequences have owners set whereas the Tables do not.

We have reproduced the issue. Starting from next public build of dotConnect for PostgreSQL "OWNER TO" statements for sequences will not be added to the backup script. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.
Pinturiccio
Devart Team
 
Posts: 2020
Joined: Wed 02 Nov 2011 09:44

Re: PgSqlDump

Postby damon.cognito » Wed 10 Jun 2015 14:12

Okay, thanks for the advice. I think on the final point I would prefer to have a choice to have owners set for all objects or not set (I actually want the tables and sequences to have their owners set).
damon.cognito
 
Posts: 50
Joined: Wed 22 Jul 2009 09:30

Re: PgSqlDump

Postby Pinturiccio » Wed 10 Jun 2015 15:10

We will investigate the possibility to implement an option determining whether to generate statements with "OWNER TO" and post here about the results as soon as possible.
Pinturiccio
Devart Team
 
Posts: 2020
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for PostgreSQL