[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GMG-Devel] migrating from sqlite3 to postgresql
From: |
Kushal Kumaran |
Subject: |
Re: [GMG-Devel] migrating from sqlite3 to postgresql |
Date: |
Sat, 19 Jul 2014 13:57:54 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Laura Arjona Reina <address@hidden> writes:
> Hi everybody
> The message below was pending to approve because it's from a sender not
> subscribed from the list.
> I was fighting the spam and I think I set this one "Approve", but it
> seems I did something wrong, because the message didn't arrive the list.
>
> So I copy it below, sorry for the inconveniences.
>
> Regards
> --
> Laura Arjona
> https://wiki.debian.org/LauraArjona
>
>
> ---------------------------
> -- beginning of message ---
> ---------------------------
> Message-ID: <address@hidden>
> Date: Wed, 16 Jul 2014 00:05:20 +0000
> From: Jan <address@hidden>
>
> ---Hi kushal and all others on the list
>
> just a short information.
>
> i did the migration using your guide. had some troubles with updating
> the sequences under postgres 9.3. using the code from the postgres
> wiki returned some errors:
>
>> psql:temp:9: ERROR: function max(integer, integer) does not exist
>> LINE 1: ...VAL('public.core__notifications_id_seq',
>> COALESCE(MAX(id, 1)... ^ HINT: No function matches the given name
>> and argument types. You might need to add explicit type casts.
>
> found a solution by using this code:
>
>> SELECT 'SELECT SETVAL(' ||quote_literal(quote_ident(S.relname))||
>> ', MAX(' ||quote_ident(C.attname)|| ') ) FROM '
>> ||quote_ident(T.relname)|| ';' FROM pg_class AS S, pg_depend AS D,
>> pg_class AS T, pg_attribute AS C WHERE S.relkind = 'S' AND S.oid =
>> D.objid AND D.refobjid = T.oid AND D.refobjid = C.attrelid AND
>> D.refobjsubid = C.attnum ORDER BY S.relname;
>
> (found here [1])
>
> now it works like a charm. thanks for your information about how to
> migrate from sqlite3 to postgres. a wiki entry would be great. (i hope
> that i will find some time to write a wiki entry in the near future)
>
I'm glad the info helped you. It appears that a change to the
postgresql wiki page made on June 20 has broken the query:
https://wiki.postgresql.org/index.php?title=Fixing_Sequences&action=historysubmit&diff=22657&oldid=21907
--
regards,
kushal
<#secure method=pgpmime mode=sign>