Обсуждение: column names in select don't exists in insert to

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

column names in select don't exists in insert to

От
"Johan"
Дата:
Hi,
I encountered a strange problem while trying to solve a bug. I use a
postgresql 8.x database and a jdbc driver from
postgresql-8.1dev-400.jdbc3.jar. The following is happening

The table is created like
create table test (
  field1 int8 not null,
  field2 int8 not null);

if I do a

select field1 from test;

results are returned normal, no problems at all, but when i do a

insert into test (field2, field1) values (1, 2);

It complains that field1 doesn't exists.

Has anyone encountered this same problem or does have anyone a pointer
for a bit more info on this problem?

Thanks,

Johan


Re: column names in select don't exists in insert to

От
Michael Fuhr
Дата:
On Wed, Sep 20, 2006 at 02:29:16PM -0700, Johan wrote:
> I encountered a strange problem while trying to solve a bug. I use a
> postgresql 8.x database and a jdbc driver from
> postgresql-8.1dev-400.jdbc3.jar. The following is happening

Any reason you're not using the latest, postgresql-8.1-407.jdbc3.jar?

> The table is created like
> create table test (
>   field1 int8 not null,
>   field2 int8 not null);
>
> if I do a
>
> select field1 from test;
>
> results are returned normal, no problems at all, but when i do a
>
> insert into test (field2, field1) values (1, 2);
>
> It complains that field1 doesn't exists.

I can't reproduce this problem; could you post a complete test case?
Do you see the problem if you execute the same statements in psql?

--
Michael Fuhr

Re: column names in select don't exists in insert to

От
Scott Marlowe
Дата:
On Wed, 2006-09-20 at 16:29, Johan wrote:
> Hi,
> I encountered a strange problem while trying to solve a bug. I use a
> postgresql 8.x database and a jdbc driver from
> postgresql-8.1dev-400.jdbc3.jar. The following is happening
>
> The table is created like
> create table test (
>   field1 int8 not null,
>   field2 int8 not null);
>
> if I do a
>
> select field1 from test;
>
> results are returned normal, no problems at all, but when i do a
>
> insert into test (field2, field1) values (1, 2);
>
> It complains that field1 doesn't exists.
>
> Has anyone encountered this same problem or does have anyone a pointer
> for a bit more info on this problem?

What happens if you run those commands from psql?  They work fine for me
in pg 7.4 and 8.1 from psql.

Have you got an example in java that causes this you can show?

Re: column names in select don't exists in insert to

От
"Johan"
Дата:
Michael Fuhr schreef:

> On Wed, Sep 20, 2006 at 02:29:16PM -0700, Johan wrote:
> > I encountered a strange problem while trying to solve a bug. I use a
> > postgresql 8.x database and a jdbc driver from
> > postgresql-8.1dev-400.jdbc3.jar. The following is happening
>
> Any reason you're not using the latest, postgresql-8.1-407.jdbc3.jar?
>
> > The table is created like
> > create table test (
> >   field1 int8 not null,
> >   field2 int8 not null);
> >
> > if I do a
> >
> > select field1 from test;
> >
> > results are returned normal, no problems at all, but when i do a
> >
> > insert into test (field2, field1) values (1, 2);
> >
> > It complains that field1 doesn't exists.
>
> I can't reproduce this problem; could you post a complete test case?
> Do you see the problem if you execute the same statements in psql?
>
> --
> Michael Fuhr
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

Someone executed the query in psql for me and the problem seems to be
in a stored procedure triggered after update. This procedure complains
about the field.

Thanks for the help.

Johan


Re: column names in select don't exists in insert to

От
Michael Fuhr
Дата:
On Thu, Sep 21, 2006 at 01:32:47AM -0700, Johan wrote:
> Someone executed the query in psql for me and the problem seems to be
> in a stored procedure triggered after update. This procedure complains
> about the field.

Were you able to fix the problem or are you still uncertain what
the problem is?  If the problem still exists then please post a
simple but complete test case, including the exact error message
you're getting.

--
Michael Fuhr

Re: column names in select don't exists in insert to

От
"Johan"
Дата:
Michael Fuhr schreef:

> On Thu, Sep 21, 2006 at 01:32:47AM -0700, Johan wrote:
> > Someone executed the query in psql for me and the problem seems to be
> > in a stored procedure triggered after update. This procedure complains
> > about the field.
>
> Were you able to fix the problem or are you still uncertain what
> the problem is?  If the problem still exists then please post a
> simple but complete test case, including the exact error message
> you're getting.
>
> --
> 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

I was able to fix te problem. Now the statement is working fine

Thanks