Changeset 255

Show
Ignore:
Timestamp:
07/01/11 18:54:22 (3 years ago)
Author:
depesz
Message:

Make fast.dump dump also meta information about fkeys, to make it simpler to restore them properly

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/fast.dump.and.restore/fast.dump

    r254 r255  
    418418    $self->run_command( $self->{ 'psql' }, '-qAtX', '-F', "\t", '-f', $sql_filename ); 
    419419 
     420    open $sql_fh, '>', $sql_filename or croak( "Cannot re-write to $sql_filename: $OS_ERROR\n" ); 
     421    print $sql_fh "\\o " . File::Spec->catfile( $self->{ 'output' }, 'fkeys.ordering' ) . "\n"; 
     422    print $sql_fh 
     423"SELECT n.nspname, c.conname, c.conrelid::regclass, c.confrelid::regclass, pg_relation_size( c.conrelid ) + pg_relation_size( c.confrelid ) as tables_size FROM pg_constraint c JOIN pg_namespace n on c.connamespace = n.oid WHERE c.contype = 'f';\n"; 
     424    close $sql_fh; 
     425 
     426    $self->run_command( $self->{ 'psql' }, '-qAtX', '-F', "\t", '-f', $sql_filename ); 
     427    unlink $sql_filename; 
     428 
    420429    return; 
    421430}