Thread: Problem with inserting data into a table.....

Problem with inserting data into a table.....

From
Sharon Abu
Date:
Hi All,

new to postgreSQL.....

I'm running postgreSQL 8.0.1 on win 2k and and i have created a database
(for testing....) using pgAdmin-III application
i'v'e also managed to create table with just few simple columns... so far so
good.

The problem arises when i'm trying to insert some data into the table using
the following statement:

insert into  COL_LED_TBL
(LED_STATE_COLOR,NEID,LED_STATE_MODE,PHY_INDEX,PORT_INDEX,MODE_DFGH)
values (1,1234,3,0,104,'test led numbetr 1');

the name of the table & its columns are correct (I've checked it....)

The execution fails with the following message :  ERROR:  relation
"col_led_tbl" does not exist

It seems that it doesn't recognize the table at all ?!

I've tried to execute it from pgAdmin SQL Query tool & also from psql
utility both present me the same error above...

Does any one could point me to the problem ?

Appreciate any help...

sharon





Re: Problem with inserting data into a table.....

From
"FERREIRA William (COFRAMI)"
Date:

maybe you can try to add the name of the schema like this :

insert into  my_schema.COL_LED_TBL
(LED_STATE_COLOR,NEID,LED_STATE_MODE,PHY_INDEX,PORT_INDEX,MODE_DFGH)
values (1,1234,3,0,104,'test led numbetr 1');

-----Message d'origine-----
De : Sharon Abu [mailto:Sharon_Abu@PacketLight.com]
Envoyé : mardi 22 février 2005 13:08
À : 'pgsql-general@postgresql.org'
Objet : [GENERAL] Problem with inserting data into a table.....

Hi All,

new to postgreSQL.....

I'm running postgreSQL 8.0.1 on win 2k and and i have created a database
(for testing....) using pgAdmin-III application
i'v'e also managed to create table with just few simple columns... so far so
good. 

The problem arises when i'm trying to insert some data into the table using
the following statement:

insert into  COL_LED_TBL
(LED_STATE_COLOR,NEID,LED_STATE_MODE,PHY_INDEX,PORT_INDEX,MODE_DFGH)
values (1,1234,3,0,104,'test led numbetr 1');

the name of the table & its columns are correct (I've checked it....)

The execution fails with the following message :  ERROR:  relation
"col_led_tbl" does not exist

It seems that it doesn't recognize the table at all ?!

I've tried to execute it from pgAdmin SQL Query tool & also from psql
utility both present me the same error above...

Does any one could point me to the problem ?

Appreciate any help...

sharon



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.

Re: Problem with inserting data into a table.....

From
Richard Huxton
Date:
Sharon Abu wrote:
> Hi All,
>
> new to postgreSQL.....
>
> I'm running postgreSQL 8.0.1 on win 2k and and i have created a database
> (for testing....) using pgAdmin-III application
> i'v'e also managed to create table with just few simple columns... so far so
> good.

> the name of the table & its columns are correct (I've checked it....)
>
> The execution fails with the following message :  ERROR:  relation
> "col_led_tbl" does not exist

Actually, the name of the table isn't correct.

You'll have created it using pgAdmin as an upper-case table, and are
trying to access it folded to lower-case (as in the error message).

If you create/query tables without quotes they get folded to lower-case.
Quoting creation/queries preserves case.

So:
CREATE TABLE "Foo" ...
SELECT * FROM "Foo" (works)
SELECT * FROM Foo (fails, gets folded to lower-case)
CREATE TABLE Bar ...
SELECT * FROM Bar (works)
SELECT * FROM BAR (works)
SELECT * FROM "bar" (works)
SELECT * FROM "Bar" (fails - it was created as lower-case)

You might find section 4.1 of the manuals useful, as well as the FAQ
   http://www.postgresql.org/files/documentation/faqs/FAQ.html

In fact, if possible make a nice hot cup of tea/coffee, put a favourite
CD on, put up your feet and read the FAQ and first third of the manuals
before going any further. Time well spent, I can guarantee it.

--
   Richard Huxton
   Archonet Ltd

Re: Problem with inserting data into a table.....

From
Ragnar Hafstað
Date:
On Tue, 2005-02-22 at 14:08 +0200, Sharon Abu wrote:

> insert into  COL_LED_TBL
> (LED_STATE_COLOR,NEID,LED_STATE_MODE,PHY_INDEX,PORT_INDEX,MODE_DFGH)
> values (1,1234,3,0,104,'test led numbetr 1');
>
> the name of the table & its columns are correct (I've checked it....)
>
> The execution fails with the following message :  ERROR:  relation
> "col_led_tbl" does not exist

postgres folds names to lowercase. either create your table and it's
columns with lowercase names, or quote the names:

insert into  "COL_LED_TBL" ("LED_STATE_COLOR", "NEID","LED_STATE_MODE",
"PHY_INDEX", "PORT_INDEX", "MODE_DFGH")
values (1,1234,3,0,104,'test led numbetr 1');

gnari