473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

sequence rename?

So I am renaming a table, and the last stumbling block
that I've met is the associated sequence. I tried the
commands suggested @

http://mailman.fastxs.net/pipermail/...st/004307.html

ie:

CREATE SEQUENCE $newseq
SELECT setval('$newseq', max($column)) FROM $table
ALTER TABLE $table ALTER COLUMN $column SET DEFAULT
nextval('$newseq'::text)
DROP SEQUENCE $oldseq

but when trying to perform the DROP SEQUENCE (psql), i
get a message like:

ERROR: Cannot drop sequence $oldseq because table
$table column $column requires it
You may drop table $table column $column instead
After that, I tried the query suggested here:

http://www.commandprompt.com/ppbook/...OVINGASEQUENCE
(example 7-34)

And it came back empty.

What am I doing wrong? when i \d $table, it shows no
such dependency. Is there another way to pull this
off?

thanks

ben

ps -- please cc responses directly to me, since i'm
not a subscriber.

_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.
http://messenger.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
1 2764
On Fri, Oct 01, 2004 at 01:17:38PM -0700, ben f wrote:
So I am renaming a table, and the last stumbling block
that I've met is the associated sequence. I tried the
commands suggested @

http://mailman.fastxs.net/pipermail/...st/004307.html

ie:

CREATE SEQUENCE $newseq
SELECT setval('$newseq', max($column)) FROM $table
ALTER TABLE $table ALTER COLUMN $column SET DEFAULT
nextval('$newseq'::text)
DROP SEQUENCE $oldseq


How about

ALTER TABLE $oldseq RENAME TO $newseq;

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Y eso te lo doy firmado con mis lágrimas" (Fiebre del Loco)
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tom | last post by:
I'm having a problem using a path with spaces as a parameter to os.rename() in a program on WinXP. This works fine at the command line (where the folder "c:\aa bb" exists) > os.rename( "c\aa...
3
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
1
by: Jay at SCA | last post by:
I've been having the following issue with a windows service I've created in vb.net (.net fw 1.1): Basically, my service monitors a folder for the creation of any new files of a particular type...
2
by: Bruce Russell | last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the solution explorer. The file is located in my local web server at C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx Is there...
5
by: Tony Meyer | last post by:
On Windows, if I do os.rename(old, new) where old is a file that is in-use (e.g. python itself, or a dll that is loaded), I would expect that an error would be raised (e.g. as when os.remove is...
6
by: shuaishuaiyes | last post by:
Hello everyone... I'm a Chinese student and my English is very poor...So excuse me if I make grammar mistake. I want to ask some questions about "rename". I'm a beginner, so my C ..... :) I...
1
by: cheesey_toastie | last post by:
I have a long query which I have set off and would like to stop, and rename one of the tables used. My query is due to my lack of understanding of the underlying structure of MSSQL-Server... ...
2
by: =?iso-8859-1?b?cultaQ==?= | last post by:
Hi, I would like to rename files (jpg's ones) using a text file containing the new names... Below is the code that doesn't work : ***** #!/usr/bin/python #-*- coding: utf-8 -*- from os...
7
by: Bob Altman | last post by:
Using VS 2008 SP1, is there a way to rename a CSS style and all of the references to that style (short of doing a global find-and-replace in the code)? You'd think that the Manage Styles and Apply...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.