Re: [INTERFACES] Bug in psql?
От | José Soares |
---|---|
Тема | Re: [INTERFACES] Bug in psql? |
Дата | |
Msg-id | 3738316B.47CED3BB@sferacarta.com обсуждение исходный текст |
Ответ на | Re: [INTERFACES] Bug in psql? (Bruce Tong <zztong@laxmi.ev.net>) |
Список | pgsql-interfaces |
<tt>The error is about name lenght. Max. 31 char.</tt><br /><tt>SERIAL types automatically creates an index name like:</tt><br/><tt> globalafvigelse_globalafviggelse_key</tt><br /><tt>which is longer than 31 char.</tt><br /><tt>Youhave to cut the table/key name to fit into 26 char (the sum of both).</tt><br /><tt>take a look:</tt><br /><tt></tt> <tt></tt><p><tt>$psql prova < 1</tt><br /><tt> create table globalafvigelse</tt><br /><tt> (</tt><br /><tt> globalafvigelse serial ,</tt><br /><tt> startdato date,</tt><br /><tt> slutdato date,</tt><br /><tt> dagskema varchar(50),</tt><br /><tt> primary key (globalafvigelse)</tt><br /><tt> );</tt><br /><tt>ERROR: CREATE TABLE/SERIAL implicit sequence name must be less than 32 characte</tt><br /><tt>rs</tt><br /><tt> Sum of lengths of 'globalafvigelse' and 'globalafvigelse' must be less t</tt><br /><tt>han 27</tt><tt></tt><p><tt>createtable globalafvigelse</tt><br /><tt> (</tt><br /><tt> globalafvig serial ,</tt><br /><tt> startdato date,</tt><br /><tt> slutdato date,</tt><br /><tt> dagskema varchar(50),</tt><br /><tt> primarykey (globalafvig)</tt><br /><tt> );</tt><br /><tt>NOTICE: CREATE TABLE will create implicit sequence globalafvigelse_globalafvig_</tt><br/><tt>seq for SERIAL column globalafvigelse.globalafvig</tt><br /><tt>NOTICE: CREATETABLE/UNIQUE will create implicit index globalafvigelse_globalaf</tt><br /><tt>vig_key for table globalafvigelse</tt><br/><tt>NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index globalafvigelse_pke</tt><br /><tt>yfor table globalafvigelse</tt><br /><tt>CREATE</tt><br /><tt>EOF</tt><tt></tt><p><tt>$ psql -c '\d globalafvigelse'</tt><br/><tt>Table = globalafvigelse</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| Field | Type | Length|</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>| globalafvig | int4 not null default nextval('g | 4 |</tt><br /><tt>| startdato | date | 4 |</tt><br /><tt>| slutdato | date | 4 |</tt><br /><tt>| dagskema | varchar() | 50 |</tt><br /><tt>+----------------------------------+----------------------------------+-------+</tt><br/><tt>Indices: globalafvigelse_globalafvig_key</tt><br/><tt> globalafvigelse_pkey</tt><br /><tt></tt> <p>Jose' <br /> <p>BruceTong ha scritto: <blockquote type="CITE">> I tried to create the table below using psql, but it bombed out <br/>> with a message about loosing the backend, though the backend was <br />> still running nicely. It seems to bea problem with the long <br />> field name of the serial (and primary key) column. <p>Have you tried putting the followinginto a file and using... <p># psql -f foo.sql <p>... to run it? I _think_ this sometimes gives different messagesthan <br />entering it directly on the psql command line, although I'm not sure why. <br />I could be way off here,but its worth a try. <p>> create table globalafvigelse <br />> ( <br />> globalafvigelse serial , <br/>> startdato date, <br />> slutdato date, <br />> dagskema varchar(50), <br />> primary key(globalafvigelse) <br />> ); <p>What is type "serial"? It probably not incorrect, but I've not heard of it <br />before.<p>Bruce Tong | Got me an office; I'm there late at night. <br />Systems Programmer | Just send me e-mail, maybe I'll write. <br />Electronic Vision / FITNE | <br />zztong@laxmi.ev.net | -- Joe Walshfor the 21st Century</blockquote><p>-- <br />______________________________________________________________ <br />PostgreSQL6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3 <br />^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br />Jose' <br />
В списке pgsql-interfaces по дате отправления: