pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julius Tuskenis <julius@nsoft.lt>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: changing sequence in serial field
Date: Fri, 04 Jul 2008 09:41:42 +0300
Message-ID: <486DC626.7040008@nsoft.lt> (raw)
In-Reply-To: <200807031808.47683.achill@matrix.gatewaynet.com>
References: <486CE004.8000400@nsoft.lt>
	<200807031808.47683.achill@matrix.gatewaynet.com>

Hello Achilleas.

I think you are wrong on this point - I can create some sequence (the 
owner is set) and then drop it easily. I think this is because

b_prekes_br_kodas_pbk_id_seq1 was created automatically creating serial field and is in some way connected to it. Thats why I get error saying "...column pbk_id requires it." Any way I can't find a way to find and alter this dependency.



Achilleas Mantzios rašė:
> Στις Thursday 03 July 2008 18:19:27 ο/η Julius Tuskenis έγραψε:
>   
>> Sorry - that doesnt work.
>>     
> That was in 8.3.3
> Your mileage may vary. But the key is to get rid of the dependency.
>   
>>> try
>>> ALTER SEQUENCE b_prekes_br_kodas_pbk_id_seq1 OWNED BY NONE;
>>> first, adn then drop.
>>>   
>>>
>>>       
>> ERROR:  syntax error at or near "OWNED"
>> LINE 1: ALTER SEQUENCE b_prekes_br_kodas_pbk_id_seq1 OWNED BY NONE;
>>                                                      ^
>>
>> ********** Error **********
>>
>> ERROR: syntax error at or near "OWNED"
>> SQL state: 42601
>> Character: 46
>>
>>
>> I also tried ALTER table b_prekes_br_kodas_pbk_id_seq1 OWNER TO NONE;
>> but this gives:
>>
>> ERROR:  role "none" does not exist
>>
>> ********** Error **********
>>
>> ERROR: role "none" does not exist
>> SQL state: 42704
>>
>>
>>     
>
>
>
>   

Achilleas Mantzios rašė:
> Στις Thursday 03 July 2008 17:19:48 ο/η Julius Tuskenis έγραψε:
>   
>> Hello
>>
>> I noticed, that some serial field is using wrong sequence, so I altered 
>> the default value pointing to the sequence I want, but now I cant delete 
>> currently no longer used sequence. Did I do someting wrong changing it?
>>
>> PgSQL 8.1 on Gentoo Linux.
>>
>>
>> What I try to do
>> DROP SEQUENCE b_prekes_br_kodas_pbk_id_seq1;
>>     
>
> try
> ALTER SEQUENCE b_prekes_br_kodas_pbk_id_seq1 OWNED BY NONE;
> first, adn then drop.
>
>   
>> Result
>> ERROR:  cannot drop sequence b_prekes_br_kodas_pbk_id_seq1 because table 
>> b_prekes_br_kodas column pbk_id requires it
>> HINT:  You may drop table b_prekes_br_kodas column pbk_id instead.
>>
>> ********** Error **********
>>
>> ERROR: cannot drop sequence b_prekes_br_kodas_pbk_id_seq1 because table 
>> b_prekes_br_kodas column pbk_id requires it
>> SQL state: 2BP01
>> Hint: You may drop table b_prekes_br_kodas column pbk_id instead.
>>
>> -- 
>> Julius Tuskenis
>> Programavimo skyriaus vadovas
>> UAB nSoft
>> mob. +37068233050
>>
>>
>>     
>
>
>
>   


-- 
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050




view thread (4+ messages)  latest in thread

Message-ID: <486DC626.7040008@nsoft.lt>
Permalink:  ../486DC626.7040008@nsoft.lt/
Also on:    postgresql.org/message-id/486DC626.7040008@nsoft.lt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: julius@nsoft.lt, achill@matrix.gatewaynet.com
  Subject: Re: changing sequence in serial field
  In-Reply-To: <486DC626.7040008@nsoft.lt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox