you can convert from type to type using ::varchar or ::char(size) or ::integer<br />so you can use sequence but you
willhave to convert it's result to suitable type (that can also be put in default value of user_id attribute)<br /><br
/><divclass="gmail_quote">On Fri, May 11, 2012 at 9:30 PM, Carlos Mennens <span dir="ltr"><<a
href="mailto:carlos.mennens@gmail.com"target="_blank">carlos.mennens@gmail.com</a>></span> wrote:<br /><blockquote
class="gmail_quote"style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Thanks for all the help thus
fareveryone! I sadly didn't<br /> create/design the table and would love to create a SEQUENCE on that<br /> particular
fieldbut not sure how unless I DROP the table and create<br /> from scratch.<br /><br /> Currently the data TYPE on the
primarykey field (users_id) is CHAR<br /> and I have no idea why...it should be NUMERIC or SERIAL but it's not<br /> so
myquestion is if I want to ALTER the column and create a sequence,<br /> would I simply do:<br /><br /> ALTER TABLE
users<br/> ALTER COLUMN users_id TYPE serial<br /> ;<br /><br /> Obviously if any of the data stored in users_id is
actualCHAR, I'm<br /> guessing the database would reject that request to change type as the<br /> existing data would
match.However the data type is CHAR but the field<br /> values are all numeric from 1000000010 - 1000000301 so I'm
hopingthat<br /> would work for SERIAL which is just INTEGER, right?<br /><span class="HOEnZb"><font
color="#888888"><br/> --<br /> Sent via pgsql-sql mailing list (<a
href="mailto:pgsql-sql@postgresql.org">pgsql-sql@postgresql.org</a>)<br/> To make changes to your subscription:<br /><a
href="http://www.postgresql.org/mailpref/pgsql-sql"target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><br
/></font></span></blockquote></div><br/><br clear="all" /><br />-- <br />---------------------------------------<br
/>ViktorBojović<br />---------------------------------------<br />Wherever I go, Murphy goes with me<br />