Обсуждение: Why does this not work? (keyword 'TEXT')

Поиск
Список
Период
Сортировка

Why does this not work? (keyword 'TEXT')

От
"Johann Zuschlag"
Дата:
Hi,

If I look thru the keywords table, I don't find 'TEXT', but:

all-test=# create table text (textid varchar(10));
ERROR:  type named text already exists

(new database)

Maybe I misunderstood something.

regards

Johann Zuschlag
zuschlag@online.de



Re: Why does this not work? (keyword 'TEXT')

От
Fran Fabrizio
Дата:
Johann Zuschlag wrote:
> Hi,
>
> If I look thru the keywords table, I don't find 'TEXT', but:

...but just like the error says, it's a datatype so it's probably a
reserved word.

-Fran


Doc error? was: Why does this not work? (keyword 'TEXT')

От
"Johann Zuschlag"
Дата:
On Tue, 09 Apr 2002 14:17:41 -0400, Fran Fabrizio wrote:

>Johann Zuschlag wrote:
>> Hi,
>>
>> If I look thru the keywords table, I don't find 'TEXT', but:
>
>...but just like the error says, it's a datatype so it's probably a
>reserved word.

I agree, but then the docs need to be corrected.

regards

Johann Zuschlag
zuschlag@online.de



Re: Why does this not work? (keyword 'TEXT')

От
Tom Lane
Дата:
"Johann Zuschlag" <zuschlag@online.de> writes:
> If I look thru the keywords table, I don't find 'TEXT', but:

That's because it's not a keyword.

> all-test=# create table text (textid varchar(10));
> ERROR:  type named text already exists

Every table has an associated datatype of the same name (to wit,
its row type).  So there's a naming conflict when the system tries
to create the row type for your table.

            regards, tom lane

Re: Why does this not work? (keyword 'TEXT')

От
"Johann Zuschlag"
Дата:
On Tue, 09 Apr 2002 16:53:16 -0400, Tom Lane wrote:

>> all-test=# create table text (textid varchar(10));
>> ERROR:  type named text already exists
>
>Every table has an associated datatype of the same name (to wit,
>its row type).  So there's a naming conflict when the system tries
>to create the row type for your table.

Hi Tom,

but that won't help me if I have to port an app. from MS-SQL
to PostgreSQL. I can't change the app.
Ok, I can patch the ODBC-driver, but there should be
a smarter solution in future.

And what do you thing about that one:

DEBUG:  query: declare SQL_CUR01F61ED0 cursor for SELECT t29.* FROM STUECKLI  t29 WHERE t29.artikelnum = '010001' AND
t29.artIS NULL  
ORDER BY t29.artikelnum ASC, t29.art ASC, t29.Position ASC, t29.stueckarti ASC, t29.stckid ASC
ERROR:  No such attribute or function 'position'

position is not anymore a keyword, IIRC.
Usually I just patch the ODBC-driver and it works for me.

regards

Johann Zuschlag
zuschlag@online.de



Re: Why does this not work? (keyword 'TEXT')

От
Martijn van Oosterhout
Дата:
On Wed, Apr 10, 2002 at 03:55:33PM +0200, Johann Zuschlag wrote:
> And what do you thing about that one:
>
> DEBUG:  query: declare SQL_CUR01F61ED0 cursor for SELECT t29.* FROM STUECKLI  t29 WHERE t29.artikelnum = '010001' AND
t29.artIS NULL  
> ORDER BY t29.artikelnum ASC, t29.art ASC, t29.Position ASC, t29.stueckarti ASC, t29.stckid ASC
> ERROR:  No such attribute or function 'position'
>
> position is not anymore a keyword, IIRC.
> Usually I just patch the ODBC-driver and it works for me.

Let me guess, you have capitals in your field names. When you create the
table, *don't* put quotes around the field names. Then everything becomes
case insenstive.

HTH,
--
Martijn van Oosterhout <kleptog@svana.org>   http://svana.org/kleptog/
> Ignorance continues to thrive when intelligent people choose to do
> nothing.  Speaking out against censorship and ignorance is the imperative
> of all intelligent people.

Keyword position was: Why does this not work? (keyword 'TEXT')

От
"Johann Zuschlag"
Дата:
On Thu, 11 Apr 2002 00:06:34 +1000, Martijn van Oosterhout wrote:

>> DEBUG:  query: declare SQL_CUR01F61ED0 cursor for SELECT t29.* FROM STUECKLI  t29 WHERE t29.artikelnum = '010001'
ANDt29.art IS NULL  
>> ORDER BY t29.artikelnum ASC, t29.art ASC, t29.Position ASC, t29.stueckarti ASC, t29.stckid ASC
>> ERROR:  No such attribute or function 'position'
>>
>> position is not anymore a keyword, IIRC.
>> Usually I just patch the ODBC-driver and it works for me.
>
>Let me guess, you have capitals in your field names. When you create the
>table, *don't* put quotes around the field names. Then everything becomes
>case insenstive.

Good guess But unfortunately I don't have access to the
source code of my application. But I could try a manual creation
of the tables.

But thanks anyway. I'm just wondering about an explaination...

regards

Johann Zuschlag
zuschlag@online.de



Re: Keyword position was: Why does this not work? (keyword 'TEXT')

От
Martijn van Oosterhout
Дата:
On Wed, Apr 10, 2002 at 05:35:03PM +0200, Johann Zuschlag wrote:
> On Thu, 11 Apr 2002 00:06:34 +1000, Martijn van Oosterhout wrote:
> >Let me guess, you have capitals in your field names. When you create the
> >table, *don't* put quotes around the field names. Then everything becomes
> >case insenstive.
>
> Good guess But unfortunately I don't have access to the
> source code of my application. But I could try a manual creation
> of the tables.
>
> But thanks anyway. I'm just wondering about an explaination...

Alter Table x alter column y rename to z;

or something like that will solve your problem. If you use double-quotes in
the column name when you create the table, you'll have to use them
everywhere else too...
--
Martijn van Oosterhout <kleptog@svana.org>   http://svana.org/kleptog/
> Ignorance continues to thrive when intelligent people choose to do
> nothing.  Speaking out against censorship and ignorance is the imperative
> of all intelligent people.

Re: Doc error? was: Why does this not work? (keyword 'TEXT')

От
Bruce Momjian
Дата:
Can someone suggest a doc fix for this?

---------------------------------------------------------------------------

Johann Zuschlag wrote:
> On Tue, 09 Apr 2002 14:17:41 -0400, Fran Fabrizio wrote:
>
> >Johann Zuschlag wrote:
> >> Hi,
> >>
> >> If I look thru the keywords table, I don't find 'TEXT', but:
> >
> >...but just like the error says, it's a datatype so it's probably a
> >reserved word.
>
> I agree, but then the docs need to be corrected.
>
> regards
>
> Johann Zuschlag
> zuschlag@online.de
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Doc error? was: Why does this not work? (keyword 'TEXT')

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Can someone suggest a doc fix for this?

TEXT is *not* a keyword; the docs do not need a correction.

            regards, tom lane

> ---------------------------------------------------------------------------

> Johann Zuschlag wrote:
>> On Tue, 09 Apr 2002 14:17:41 -0400, Fran Fabrizio wrote:
>>
> Johann Zuschlag wrote:
> Hi,
>
> If I look thru the keywords table, I don't find 'TEXT', but:
>
> ...but just like the error says, it's a datatype so it's probably a
> reserved word.
>>
>> I agree, but then the docs need to be corrected.
>>
>> regards
>>
>> Johann Zuschlag
>> zuschlag@online.de
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Don't 'kill -9' the postmaster
>>

> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)