Dear Thomas,

In message <52d59d74.6000...@mtl.mit.edu> you wrote:
> 
> > Do you have any idea why this would happen?  Is this something I can
> > influence?
> > Are there any other variables that might hit by similar issues?
> 
> I can't say exactly why it happened to you but my guess would be that 
> this problem could hit anyone porting from mysql to postgres.  I'm not 
> familiar with the Bacula procedure for doing that (if you used one) but 

I didn't use any precanned procedure (is there one? I mean a
recommended/working one?).  Basically whay I did is dumping the DB
under MySQL:

        mysqldump -t -n -c \
           --compatible=postgresql \
           --skip-quote-names --skip-opt --quick \
           --disable-keys --lock-tables \
           --password=XXX bacula

and then importing the dump into PostgreSQL.  Hm...  Thinking about
that.. I did initialize the PostgreSQL DB using the Bacula provided
"create_bacula_database", "make_bacula_tables" and
"grant_bacula_privileges" scripts.  

> any Postgres sequence creations during the Postgres DB setup would more 
> than likely be created with a default starting value of 1 - but if 
> you've already got data in your database (migrated over from Mysql) then 
> all sequences would need to be seeded properly.  The bad news for you 
> may be that almost all of the Bacula tables have sequences to generate 
> their id fields.
> 
> client
> file
> filename
> path
> job
> jobmedia
> fileset
> media
> pool

Ouch...  You are right, I see the same with clientid: max=33, but
client_clientid_seq last_value=1 :-(

> > Sorry, my DB / sql knowledge is somewhat limited (read: non-existient).
> > Could you please be so kind and tell me how I could fix that?
> 
> Well, if your DB knowledge is limited then you may want to consult 
> someone in your location who may be able to assist.  Given that, I'll 

Heh.  There is none...  That's why I'm asking here...

> say the next part with the usual "use at your own risk" disclaimer.  To 
> change the last_value field of a Postgres sequence, you need to use the 
> Postgres alter sequence command
> 
> e.g.
> 
> alter sequence fileset_filesetid_seq restart with 76;

I tried that, but it fails:

    Enter SQL query: alter sequence fileset_filesetid_seq restart with 76;
    Query failed: ERROR:  must be owner of relation fileset_filesetid_seq

I ran this under "bconsole", i. e. as user bacula - is this not the
right thing to do?

> This may be dependent on your version of Postgres.  I am using 9.1.x and 
> am looking at the following documentation:

I'm running postgresql-9.3.2 under Fedora 20 / x86_64.

> http://www.postgresql.org/docs/9.1/static/sql-altersequence.html
> 
> I would then redo that above procedure for each of the sequences for 
> each of the Bacula tables (querying to get the max value currently used 
> and then resetting the last_value field to <max value> + 1).

Wii trry that - if I manage ti fiure out how to solve this "must be
owner" issue.

After reading some docs I tried this:

SELECT c.relname,c.relowner FROM pg_class c WHERE c.relkind = 'S';
+-----------------------------------+----------+
| relname                           | relowner |
+-----------------------------------+----------+
| filename_filenameid_seq           | 10       |
| job_jobid_seq                     | 10       |
| location_locationid_seq           | 10       |
| restoreobject_restoreobjectid_seq | 10       |
| fileset_filesetid_seq             | 10       |
| client_clientid_seq               | 10       |
| media_mediaid_seq                 | 10       |
| jobmedia_jobmediaid_seq           | 10       |
| mediatype_mediatypeid_seq         | 10       |
| device_deviceid_seq               | 10       |
| basefiles_baseid_seq              | 10       |
| locationlog_loclogid_seq          | 10       |
| log_logid_seq                     | 10       |
| path_pathid_seq                   | 10       |
| pool_poolid_seq                   | 10       |
| file_fileid_seq                   | 10       |
| storage_storageid_seq             | 10       |
+-----------------------------------+----------+

OK, now I know which sequences I have to check, but I still don't know
what owner "10" means...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Brain: an apparatus with which we think we think.    - Ambrose Bierce

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to