Unix Technical Forum

Re: php cant see new table!!

This is a discussion on Re: php cant see new table!! within the pgsql Novice forums, part of the PostgreSQL category; --> Hi, Thanks for the response Michael. I have read over the documentation but I am still unclear as to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 10:38 PM
Sears, Jeremy
 
Posts: n/a
Default Re: php cant see new table!!


Hi,
Thanks for the response Michael. I have read over the documentation but I am
still unclear as to why php doesnt see my new table. I can see it in my
database, however php is unable to access it. I suspect that in the process
of creating the table I must have missed an essential command or somthing..
Can anyone suggest what Ive missed?

Thanks
Jeremy

this is the sql I used to creat the table:

CREATE TABLE "st"."IAM_appid" (
"id" INTEGER NOT NULL,
"application" CHAR(25) NOT NULL,
CONSTRAINT "IAM_appid_id_key" UNIQUE("id")
) WITH OIDS;

COMMENT ON COLUMN "st"."IAM_appid"."id"
IS 'application ID';

COMMENT ON COLUMN "st"."IAM_appid"."application"
IS 'description';


-----Original Message-----
* From: Michael Fuhr <mike ( at ) fuhr ( dot ) org>
* To: "Sears, Jeremy" <Jeremy ( dot ) Sears ( at ) CCRS ( dot ) NRCan (
dot ) gc ( dot ) ca>
* Subject: Re: php cant see new table!!
* Date: Fri, 17 Feb 2006 21:39:42 -0700

On Fri, Feb 17, 2006 at 10:55:10AM -0500, Sears, Jeremy wrote:
> I have sucessfully created a new table in a schema known as "st". I can

view
> the contents of my database and see that this table exists. However when I
> attempt to connect to it via php, I get the following error:
>
> Warning: pg_query(): Query failed: ERROR: relation "st.iam" does not exist


Is the table name st.iam or st."IAM"? If you don't understand the
difference then see the section about quoted identifiers in the
documentation:

http://www.postgresql.org/docs/8.1/i...#SQL-SYNTAX-ID
ENTIFIERS

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 10:38 PM
Michael Fuhr
 
Posts: n/a
Default Re: php cant see new table!!

On Thu, Feb 23, 2006 at 10:38:27AM -0500, Sears, Jeremy wrote:
> Thanks for the response Michael. I have read over the documentation but I am
> still unclear as to why php doesnt see my new table. I can see it in my
> database, however php is unable to access it. I suspect that in the process
> of creating the table I must have missed an essential command or somthing..

[...]
> this is the sql I used to creat the table:
>
> CREATE TABLE "st"."IAM_appid" (
> "id" INTEGER NOT NULL,
> "application" CHAR(25) NOT NULL,
> CONSTRAINT "IAM_appid_id_key" UNIQUE("id")
> ) WITH OIDS;


Is this the same table you were trying to access when you got the
error? The error in your original message was

> > Warning: pg_query(): Query failed: ERROR: relation "st.iam" does not exist


which isn't the same table. Aside from that it still looks like
the problem is due to quoted identifiers. Your code is probably
doing something like this:

SELECT * FROM st.IAM_appid;

when it should be doing this:

SELECT * FROM st."IAM_appid";

Notice the quotes around the table name in the second case. Unquoted
identifiers are folded to lowercase, as you can see in the following
error message:

test=> SELECT * FROM st.IAM_appid;
ERROR: relation "st.iam_appid" does not exist

Since you created the table with mixed case and quotes you'll always
have to use a quoted identifier and that exact case; some people
avoid quoted identifiers for that reason. Without quotes you can
still use mixed case but the identifiers will be folded to lower
case:

test=> CREATE TABLE Foo (bAR integer);
CREATE TABLE
test=> \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+-------
public | foo | table | mfuhr
(1 row)

test=> \d foo
Table "public.foo"
Column | Type | Modifiers
--------+---------+-----------
bar | integer |

SELECT Bar FROM fOO;
bar
-----
(0 rows)

--
Michael Fuhr

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 10:39 PM
Guido Barosio
 
Posts: n/a
Default Re: php cant see new table!!

Jeremy

line a) $query = "SELECT * from st.IAM";
line b) CREATE TABLE "st"."IAM_appid" (...

Your table name is st.IAM_appid.You query looks just for st.IAM

but for the time, almost 10 days after your first post, I am sure you
already sorted this.

Just for the record

g.-






On 3/1/06, Michael Fuhr <mike@fuhr.org> wrote:
>
> On Thu, Feb 23, 2006 at 10:38:27AM -0500, Sears, Jeremy wrote:
> > Thanks for the response Michael. I have read over the documentation but

> I am
> > still unclear as to why php doesnt see my new table. I can see it in my
> > database, however php is unable to access it. I suspect that in the

> process
> > of creating the table I must have missed an essential command or

> somthing..
> [...]
> > this is the sql I used to creat the table:
> >
> > CREATE TABLE "st"."IAM_appid" (
> > "id" INTEGER NOT NULL,
> > "application" CHAR(25) NOT NULL,
> > CONSTRAINT "IAM_appid_id_key" UNIQUE("id")
> > ) WITH OIDS;

>
> Is this the same table you were trying to access when you got the
> error? The error in your original message was
>
> > > Warning: pg_query(): Query failed: ERROR: relation "st.iam" does not

> exist
>
> which isn't the same table. Aside from that it still looks like
> the problem is due to quoted identifiers. Your code is probably
> doing something like this:
>
> SELECT * FROM st.IAM_appid;
>
> when it should be doing this:
>
> SELECT * FROM st."IAM_appid";
>
> Notice the quotes around the table name in the second case. Unquoted
> identifiers are folded to lowercase, as you can see in the following
> error message:
>
> test=> SELECT * FROM st.IAM_appid;
> ERROR: relation "st.iam_appid" does not exist
>
> Since you created the table with mixed case and quotes you'll always
> have to use a quoted identifier and that exact case; some people
> avoid quoted identifiers for that reason. Without quotes you can
> still use mixed case but the identifiers will be folded to lower
> case:
>
> test=> CREATE TABLE Foo (bAR integer);
> CREATE TABLE
> test=> \d
> List of relations
> Schema | Name | Type | Owner
> --------+------+-------+-------
> public | foo | table | mfuhr
> (1 row)
>
> test=> \d foo
> Table "public.foo"
> Column | Type | Modifiers
> --------+---------+-----------
> bar | integer |
>
> SELECT Bar FROM fOO;
> bar
> -----
> (0 rows)
>
> --
> Michael Fuhr
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>




--
/"\ ASCII Ribbon Campaign .
\ / - NO HTML/RTF in e-mail .
X - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com