Re: alter column to varchar without view drop/re-creation

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: alter column to varchar without view drop/re-creation
Date: 2014-08-29 19:09:08
Message-ID: 5400CFD4.9050502@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
</div>
<blockquote cite="mid:5400C790(dot)50006(at)encs(dot)concordia(dot)ca" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hello list, <br>
<br>
May I know is there a way to "alter column type to varchar"
(previous is varchar(***)) without view drop/re-creation?<br>
<br>
Basically, looking for a way to change column without have to
drop/re-create dependent views. <br>
<br>
varchar(***) to varchar and no date/numeric changes. <br>
<br>
</blockquote>
I saw docs mention about: update pg_attribute. May I know:<br>
<br>
. will dependent views updated automatically or there might be
potential problems?<br>
. If it's fine, will the following SQL enough to change column from
varchar(***) to varchar?<br>
<br>
&nbsp; update pg_attribute set atttypmod =-1 <br>
&nbsp; where&nbsp; attrelid = 'oid' ;<br>
<br>
Thanks a lot!<br>
<br>
<blockquote cite="mid:5400C790(dot)50006(at)encs(dot)concordia(dot)ca" type="cite">
---<br>
<b>PostgreSQL 8.3.18 on x86_64</b><br>
</blockquote>
<br>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-08-29 19:16:56 Re: alter column to varchar without view drop/re-creation
Previous Message Emi Lu 2014-08-29 18:33:52 alter column to varchar without view drop/re-creation