This topic is locked

View / SQL-Queries in Postgres and PHPR

7/3/2007 4:30:52 PM
PHPRunner General questions
P
punch author

Hello
i try to change my project from mysql to postgres. Tables can be used "as usual", but i´ve got problems with SQL-Queries:
PHPR shows tables from postgres in this way: "public.tablename" instead of "tablename" with mysql.
If i make a query on one table, PHPR generates this fine running code:
-----

select

"Field1",

"Field2",

"Field3"

From "public"."tablename"

-----
But how code should be written with table-joins? I tried a lot of versions, with and without "public." as prefix, but it won´t work.
Best regards
Punch

Sergey Kornilov admin 7/3/2007

Punch,
I guess this is the page you looking for:

http://www.xlinesoft.com/phprunner/docs/us...sql_queries.htm
If this doesn't help post your SQL query along with the error message.

P
punch author 7/3/2007

Sergey,
i do not really get a error messag. My problem ist changing the query form mysql to postgres.

In mysql the query which works looks like this:
-----

select

´tbtbWirtschaftseinheit.Wirtschaftseinheit´,

´tbtbWirtschaftseinheit.ID_LE´,

´tbtbWirtschaftseinheit.Leistung´

From ´tbtbWirtschaftseinheit´ INNER JOIN ´tbtbLeistung´ ON ´tbtbWirtschaftseinheit.Wirtschaftseinheit´ = ´tbtbLeistung.Wirtschaftseinheit´

-----
With postgres, PHPR is setting a "public." in front of the tablenames, like "public.tablename"
So i tried a few versions of my query like this:
------

select

"tbtbWirtschaftseinheit.Wirtschaftseinheit",

"tbtbWirtschaftseinheit.ID_LE",

"tbtbWirtschaftseinheit.Leistung"

From "public.tbtbWirtschaftseinheit" INNER JOIN "public.tbtbLeistung" ON "tbtbWirtschaftseinheit.Wirtschaftseinheit" = "tbtbLeistung.Wirtschaftseinheit"

-----
PHPR doesn´t occures an error message. It doesn´t shows any fields in the following tabs, most parts of the tabs are empty. I guess, PHPR doesn´t recognizes the fields. My problem is, that i don´t know, where to set the prefix "public." in the query and where not.
Maybe there is instead a way that PHPR shows tables without this prefix (like in mysql)?
Best regards
Punch

Sergey Kornilov admin 7/3/2007

instead of "tbtbWirtschaftseinheit.Wirtschaftseinheit", use "tbtbWirtschaftseinheit"."Wirtschaftseinheit"

P
punch author 7/4/2007

Sergey,
i was sure, i did try this, but maybe i didn´t.
I will try it again without a "public." today and give you a feedback.
Patrick

P
punch author 7/4/2007

Sergey,
i doesn´t work at now.
If i use ab table, PHPR generates the code like:
---

select

"ID_WE",

"Wirtschaftseinheit"

From "public"."tbtbWirtschaftseinheit"

----
an i can generate all forms as usual.
If i try to add a view, PHPR doesn´t show any fields. That means, that tab "choose pages" doens´t show any fields for key columns and tab "choose fields" is empty.
I tried a query like this:
---

select

"tbtbWirtschaftseinheit"."ID_WE",

"tbtbLeistung"."Datum_Leistung"

FROM "public"."tbtbWirtschaftseinheit" INNER JOIN "public"."tbtbLeistung" ON "public"."tbtbWirtschaftseinheit"."Wirtschaftseinheit" = "public"."tbtbLeistung"."Wirtschaftseinheit"

---
and like this:
---

select

"tbtbWirtschaftseinheit"."ID_WE",

"tbtbLeistung"."Datum_Leistung"

FROM "tbtbWirtschaftseinheit" INNER JOIN "tbtbLeistung" ON "tbtbWirtschaftseinheit"."Wirtschaftseinheit" = "tbtbLeistung"."Wirtschaftseinheit"

---
I guess, the problem is the prefix which postgres serves, but postgres doesn´t allow to delete this prefix.

For some reason or other PHPR can read the tables from postgres, so i hope there is a way to add views too.
If it would help, i could send you access-data to the postgres-database by mail so that you can see the problem?
Best regards
Punch