[Pgsql-ayuda] columna NOT NULL

Eladio Rodriguez elarod01@hotmail.com
Wed, 30 Apr 2003 17:16:15 -0600


<html><div style='background-color:'><DIV>saludos. </DIV>
<DIV></DIV>erodriguez-#alter table t 
<DIV></DIV>erodriguez-#add contraint c_pk primary key (c); 
<DIV></DIV>ALTER 
<DIV></DIV>
<DIV></DIV>erodriguez-# add constraint c_pk primary key (c); 
<DIV></DIV>ERROR: Existing attribute "c" cannot be a PRIMARY KEY because it is not marked 
<DIV></DIV>NOT NULL 
<DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>y efectivamente la columna no esta marcada como NOT NULL, lo que tiene es un constraint</DIV>
<DIV>&nbsp;</DIV>
<DIV>erodriguez-# \d t<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Table "t"<BR>&nbsp;Column |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Modifiers<BR>--------+----------------------+-----------<BR>&nbsp;c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | character varying(1) |<BR>Check constraints: "c_not_null" NULL::bool</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>el comando SET LINESIZE 5000, lo que hace es que cuando el SELECT necesita presentar los datos mas alla del borde derecho se le puede dar scroll y no te salen las cosas como:</DIV>
<DIV>&nbsp;</DIV>
<DIV>erodriguez=# select * from fac_e;<BR>&nbsp;factura |&nbsp;&nbsp; fecha&nbsp;&nbsp;&nbsp; | cliente | vendedor | credito | subtotal |&nbsp; iv&nbsp; | descuen<BR>to | total<BR>---------+------------+---------+----------+---------+----------+------+--------<BR>---+-------<BR>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 2003-04-30 | 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; 0.00 | 0.00 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.<BR>00 |&nbsp; 0.00<BR>(1 row)</DIV>
<DIV>&nbsp;</DIV></div><br clear=all><hr>Protect your PC - <a href="http://g.msn.com/8HMSEN/2755">Click here</a> for McAfee.com VirusScan Online </html>