~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to utilities/pgrestore.py

  • Committer: Stuart Bishop
  • Date: 2005-12-23 04:32:52 UTC
  • mto: This revision was merged to the branch mainline in revision 2942.
  • Revision ID: stuart.bishop@canonical.com-20051223043252-f496fb211a5d3bd6
Update pgrestore.py to resture PostgreSQL 7.4 dumps under PostgreSQL 8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
 
69
69
 
70
70
def listing_cmp(a, b):
 
71
    if POSTGRESQL7:
 
72
        idx = 2
 
73
    else:
 
74
        idx = 3
71
75
    if a.startswith(';'):
72
76
        atype = ';'
73
77
    else:
74
 
        atype = a.split()[2]
 
78
        atype = a.split()[idx]
75
79
 
76
80
    if b.startswith(';'):
77
81
        btype = ';'
78
82
    else:
79
 
        btype = b.split()[2]
 
83
        btype = b.split()[idx]
80
84
 
81
85
    scores = {
82
86
        ';': 0,
155
159
            "-v", "--verbose", dest="verbose",
156
160
            action="store_true", default=False
157
161
            )
 
162
    parser.add_option(
 
163
            "-7", dest="postgres7",
 
164
            action="store_true", default=False,
 
165
            help="Restore into a PostgreSQL 7.4 database"
 
166
            )
158
167
 
159
168
    (options, args) = parser.parse_args()
160
169
 
 
170
    if options.postgres7:
 
171
        POSTGRESQL7 = True
 
172
    else:
 
173
        POSTGRESQL7 = False
 
174
 
161
175
    if len(args) > 1:
162
176
        parser.error("Too many arguments")
163
177