Thread: Postgresql error

Postgresql error

From
MarkB
Date:
I have written a program where 2 computers are connected to the same
database. The first PC executes an update statement and then sends a
notification. This makes the second PC execute a select statement on the
same table. The second PC then gets an error:

'Field "Fieldname" not found'

I have no trouble executing this same select statement in other places in
the code or from within PgAdmin.

I wonder how this is possible as an update statement does not change
anything to the tablefields. I added a delay (sleep) in the code and then
the problem does not occur, but this is hardly a solution and makes me
question the stability of other code as long as I am not certain why this
occurs.

I am fairly certain this has to do with locking. I assumed that the database
would block the select statement while the table fields are not available.

My hope is that someone can help me as I have searched for a solution for
quite some time, but am no closer to finding it.

Thanks!

The program is written using Delphi 7 and PostgresDac 2.8.0 where I use the
TPSQLQuery to execute the select and update statements and TPSQLNotify for
the notification. My Postgresql version is 9.1.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/Postgresql-error-tp5741971.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Postgresql error

From
"Kevin Grittner"
Date:
MarkB wrote:

> I have written a program where 2 computers are connected to the same
> database. The first PC executes an update statement and then sends a
> notification. This makes the second PC execute a select statement on the
> same table. The second PC then gets an error:
>
> 'Field "Fieldname" not found'
>
> I have no trouble executing this same select statement in other places in
> the code or from within PgAdmin.
>
> I wonder how this is possible as an update statement does not change
> anything to the tablefields. I added a delay (sleep) in the code and then
> the problem does not occur, but this is hardly a solution and makes me
> question the stability of other code as long as I am not certain why this
> occurs.

You need to be more specific. Look in the PostgreSQL server log and
copy/paste the exact message, with any related detail, context,
hints, etc., into you next post here. Also please connect with psql
and show the output from running \d for each table used by the
query.

-Kevin


Re: Postgresql error

From
Adrian Klaver
Date:
On 01/23/2013 04:41 PM, MarkB wrote:
> I have written a program where 2 computers are connected to the same
> database. The first PC executes an update statement and then sends a
> notification. This makes the second PC execute a select statement on the
> same table. The second PC then gets an error:
>
> 'Field "Fieldname" not found'


Is the above the exact error message?
If not what is it?
Which part of the software chain is reporting the error?

By any chance are you dealing with case sensitivity?
In other words are the fieldnames mixed case or upper case?

>
> I have no trouble executing this same select statement in other places in
> the code or from within PgAdmin.
>
> I wonder how this is possible as an update statement does not change
> anything to the tablefields. I added a delay (sleep) in the code and then
> the problem does not occur, but this is hardly a solution and makes me
> question the stability of other code as long as I am not certain why this
> occurs.
>
> I am fairly certain this has to do with locking. I assumed that the database
> would block the select statement while the table fields are not available.

Generally speaking Postgres does not block reads.

>
> My hope is that someone can help me as I have searched for a solution for
> quite some time, but am no closer to finding it.




--
Adrian Klaver
adrian.klaver@gmail.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Postgresql error

From
Craig Ringer
Date:
You really need to show the full, exact text of the error from the database as well as the SQL run by both apps and
relevantdetails of table structures. 
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Postgresql error

From
Adrian Klaver
Date:
On 01/23/2013 04:41 PM, MarkB wrote:
> I have written a program where 2 computers are connected to the same
> database. The first PC executes an update statement and then sends a
> notification. This makes the second PC execute a select statement on the
> same table. The second PC then gets an error:
>
> 'Field "Fieldname" not found'


Is the above the exact error message?
If not what is it?
Which part of the software chain is reporting the error?

By any chance are you dealing with case sensitivity?
In other words are the fieldnames mixed case or upper case?

>
> I have no trouble executing this same select statement in other places in
> the code or from within PgAdmin.
>
> I wonder how this is possible as an update statement does not change
> anything to the tablefields. I added a delay (sleep) in the code and then
> the problem does not occur, but this is hardly a solution and makes me
> question the stability of other code as long as I am not certain why this
> occurs.
>
> I am fairly certain this has to do with locking. I assumed that the database
> would block the select statement while the table fields are not available.

Generally speaking Postgres does not block reads.

>
> My hope is that someone can help me as I have searched for a solution for
> quite some time, but am no closer to finding it.




--
Adrian Klaver
adrian.klaver@gmail.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general