Re: Cloning schemas

From: Łukasz Jarych <jaryszek(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cloning schemas
Date: 2018-07-03 08:11:42
Message-ID: CAGv31odHuHpY3N8U3eyzOK8qCjdoxu78gTovuxKoKNsyb+5QOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Melvin,

I understand this but i can not update function by myself. Thnak you very
much !

Still errors here.

Something like:

ERROR: BŁĄD: you cannot add to column "TopoToVersion_ID" DETAIL: Column
"TopoToVersion_ID" is an identity column defined as GENERATED ALWAYS. HINT:
Use OVERRIDING SYSTEM VALUE to override. CONTEXT: wyrażenie SQL "INSERT
INTO version4.t_topotoversions SELECT * FROM public.t_topotoversions;"
funkcja PL/pgSQL clone_schema(text,text,boolean), wiersz 212 w EXECUTE SQL
state: 428C9

pon., 2 lip 2018 o 16:22 Melvin Davidson <melvin6925(at)gmail(dot)com> napisał(a):

>
>
> On Mon, Jul 2, 2018 at 10:14 AM, Łukasz Jarych <jaryszek(at)gmail(dot)com> wrote:
>
>>
>> Hi,
>>
>> i see. thank you
>>
>> I am using:
>>
>> [image: image.png]
>>
>> Best,
>> Jacek
>>
>> pon., 2 lip 2018 o 16:03 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
>> napisał(a):
>>
>>> On 07/02/2018 06:57 AM, Łukasz Jarych wrote:
>>> > Hi,
>>> >
>>> > "
>>> > Strange. "audit_sq" looks like an invalid sequence table. I went
>>> > here,
>>> https://www.postgresql.org/docs/9.6/static/sql-createsequence.html,
>>> > and checked all the way back to version 7.1 and "maxvalue" has been a
>>> > column since back then.
>>>
>>> What version of Postgres are you actually doing the cloning in?
>>>
>>> Per Tom's post:
>>>
>>> https://www.postgresql.org/docs/10/static/release-10.html
>>>
>>> "
>>> Move sequences' metadata fields into a new pg_sequence system catalog
>>> (Peter Eisentraut)
>>>
>>> ...
>>>
>>> A sequence relation now stores only the fields that can be modified by
>>> nextval(), that is last_value, log_cnt, and is_called.
>>>
>>> ...
>>>
>>> The main incompatibility introduced by this change is that selecting
>>> from a sequence relation now returns only the three fields named above.
>>> To obtain the sequence's other properties, applications must look into
>>> pg_sequence. The new system view pg_sequences can also be used for this
>>> purpose; it provides column names that are more compatible with existing
>>> code.
>>> "
>>>
>>> >
>>> > Maybe skip that table for now? It even says the last value is 1. You
>>> > should also check the other sequence tables. You can get them by doing:
>>> >
>>> > select * from information_schema.sequences;"
>>> >
>>> > Result of select:
>>> >
>>> > image.png
>>> >
>>> > Are you sure that I can skip " audit_sq" seq?
>>> >
>>> > I wrote here because i am newbie and i can not update this. Hope for
>>> > your help Guys.
>>> >
>>> > Best,
>>> > Jacek
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > pon., 2 lip 2018 o 15:30 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
>>> > <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> napisał(a):
>>> >
>>> > =?UTF-8?Q?=C5=81ukasz_Jarych?= <jaryszek(at)gmail(dot)com
>>> > <mailto:jaryszek(at)gmail(dot)com>> writes:
>>> > > I am trying to use :
>>> >
>>> > > "select * from clone_schema('public','Version8',true) but i am
>>> > getting
>>> > > error:
>>> >
>>> > > "Column "max_value" does not exist.
>>> > > LINE 1: SELECT last_value, max_value, start_value, increment_by,
>>> > min...
>>> > > HINT: Maybe you wanted to point to column "
>>> "audit_sq.last_value"?
>>> > > QUERY: SELECT last_value, max_value, start_value, increment_by,
>>> > min_value,
>>> > > cache_value, log_cnt, is_cycled, is_called FROM public.audit_sq;
>>> > > CONTEXT: function PL/pgSQL clone_schema(text,text,boolean), row
>>> 66 in
>>> > > EXECUTE
>>> >
>>> > I guess audit_sq is a sequence? It looks to me like this function
>>> has
>>> > not been taught about the changes in sequence metadata in PG v10.
>>> > You need to update it, or talk to its author about an update.
>>> >
>>> > regards, tom lane
>>> >
>>>
>>>
>>> --
>>> Adrian Klaver
>>> adrian(dot)klaver(at)aklaver(dot)com
>>>
>>
> Lukas,
>
> Once again, in Version 10, the developers have changed the system
> catalogs. Please use the attached clone_schema_10.sql which
> has been adjusted for PostgreSQL 10.
>
>
>
> --
> *Melvin Davidson*
> *Maj. Database & Exploration Specialist*
> *Universe Exploration Command – UXC*
> Employment by invitation only!
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2018-07-03 08:40:27 Re: Trouble matching a nested value in JSONB entries
Previous Message Rafal Pietrak 2018-07-03 07:30:45 FK v.s unique indexes