Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 89185650E8A for ; Fri, 4 Jul 2008 03:41:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48578-07 for ; Fri, 4 Jul 2008 03:41:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from vilnius.balt.net (vilnius.balt.net [195.14.170.14]) by postgresql.org (Postfix) with ESMTP id 670FF650E99 for ; Fri, 4 Jul 2008 03:41:47 -0300 (ADT) Received: from nSoft.lt (unknown [217.117.29.29]) by vilnius.balt.net (Postfix) with ESMTP id 2963A3A1090; Fri, 4 Jul 2008 09:41:42 +0300 (EEST) Received: from [192.168.16.1] (unknown [192.168.16.1]) by nSoft.lt (Postfix) with ESMTP id 9F984BF2FE; Fri, 4 Jul 2008 10:10:59 +0000 (GMT) Message-ID: <486DC626.7040008@nsoft.lt> Date: Fri, 04 Jul 2008 09:41:42 +0300 From: Julius Tuskenis User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Achilleas Mantzios CC: pgsql-admin@postgresql.org Subject: Re: changing sequence in serial field References: <486CE004.8000400@nsoft.lt> <200807031808.47683.achill@matrix.gatewaynet.com> In-Reply-To: <200807031808.47683.achill@matrix.gatewaynet.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL=0.172 X-Spam-Level: X-Archive-Number: 200807/61 X-Sequence-Number: 29671 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