Search Postgresql Archives

Re: Using row_to_json with %ROWTYPE ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/06/2015 04:19 AM, Tim Smith wrote:
Alright then, here you go ... Postgres 9.4

We start with a clean database :

json_return_debugdb=> \dn
   List of schemas
   Name  |  Owner
--------+----------
  public | postgres
(1 row)

json_return_debugdb=> \dt
No relations found.
json_return_debugdb=> \dv
No relations found.



We replicate a basic version of app_val_session_vw:

create table app_sessions (session_id bigint primary key,user_id
bigint unique not null, session_ip inet);
create table app_users (user_id bigint primary key,user_name text,
user_active boolean not null);
create view app_users_vw as select * from app_users where user_active=true;
create view app_val_session_vw as select
a.session_id,a.session_ip,b.user_name,b.user_id from app_sessions a,
app_users b where a.user_id=b.user_id;

We insert data :
insert into app_users values(1,’Foobar',true);
insert into app_sessions(441122,1,’10.11.12.13’,);



json_return_debugdb=> select
validateSession('441122','10.11.12.13','abc',3600,3600);
ERROR:  Failed to validate session for session 441122 (SQLSTATE: 42702
  - SQLERRM: column reference "session_id" is ambiguous)
HINT:  Database error occured (sval fail)

Unfortunately the function definition is not given and that is where you are seeing the error. To figure this out we will need to see the function.




--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux