Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-11 Thread Sridhar N Bamandlapally
need to return query with alias *example:* create table emp (id integer, ename text); insert into emp values(1, 'aaa'); create or replace function f_sample1() returns table (id integer, ename text) as $$ declare begin return query select id, ename from emp; end$$ language plpgsql; select f_

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 01:14 PM, Alexander Farber wrote: No, actually both variants work for me right now at 9.5.3 on Mac - I thought the question you where asking was: "Where does RETURN NEXT EXPRESSION work, on 9.6?" In the examples below you are not doing that. Inline comments below. On Wed, Au

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
No, actually both variants work for me right now at 9.5.3 on Mac - On Wed, Aug 10, 2016 at 8:31 PM, Adrian Klaver wrote: > >> Given what you are doing, RETURN TABLE it will not work there for the > same reason it does not work in 9.5: > > https://www.postgresql.org/docs/9.6/static/plpgsql-contro

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
Both variants have worked for me, thanks I am using 9.5.3 on CentOS 7 (my "production server" and Win 7, Mac (my "dev machines") :) Where does RETURN NEXT EXPRESSION work, on 9.6?

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 10:19 AM, Pavel Stehule wrote: 2016-08-10 19:05 GMT+02:00 Alexander Farber mailto:alexander.far...@gmail.com>>: Thank you Adrian and others - I am trying to replace INSERT into temp table in my custom function by RETURN NEXT, but get an error: CREATE OR REPL

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 10:30 AM, David G. Johnston wrote: On Wed, Aug 10, 2016 at 1:19 PM, Pavel Stehule mailto:pavel.steh...@gmail.com>>wrote: 2016-08-10 19:05 GMT+02:00 Alexander Farber mailto:alexander.far...@gmail.com>>: Thank you Adrian and others - I am trying to replace

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread David G. Johnston
On Wed, Aug 10, 2016 at 1:19 PM, Pavel Stehule wrote: > > > 2016-08-10 19:05 GMT+02:00 Alexander Farber : > >> Thank you Adrian and others - >> >> I am trying to replace INSERT into temp table in my custom function by >> RETURN NEXT, but get an error: >> >> CREATE OR REPLACE FUNCTION words_check_

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 19:05 GMT+02:00 Alexander Farber : > Thank you Adrian and others - > > I am trying to replace INSERT into temp table in my custom function by > RETURN NEXT, but get an error: > > CREATE OR REPLACE FUNCTION words_check_words( > IN in_uid integer, > IN in_gid integer, >

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 10:05 AM, Alexander Farber wrote: Thank you Adrian and others - I am trying to replace INSERT into temp table in my custom function by RETURN NEXT, but get an error: CREATE OR REPLACE FUNCTION words_check_words( IN in_uid integer, IN in_gid integer,

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
Thank you Adrian and others - I am trying to replace INSERT into temp table in my custom function by RETURN NEXT, but get an error: CREATE OR REPLACE FUNCTION words_check_words( IN in_uid integer, IN in_gid integer, IN in_tiles jsonb) RETURNS TABLE(word varchar, sc

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 08:28 AM, Alexander Farber wrote: There is still 1 open question - In my custom function: CREATE OR REPLACE FUNCTION words_check_words( IN in_uid integer, IN in_gid integer, IN in_tiles jsonb) RETURNS TABLE(word varchar, score in

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
There is still 1 open question - In my custom function: CREATE OR REPLACE FUNCTION words_check_words( IN in_uid integer, IN in_gid integer, IN in_tiles jsonb) RETURNS TABLE(word varchar, score integer) AS $func$ I iterate through tiles passed as last argument and

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
Thank you for confirming, I supposed I have to use RETURN QUERY and now it works.

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
t; To: pgsql-general > > Subject: [GENERAL] RETURNS TABLE function: ERROR: column reference > "word" is ambiguous > > > > Good afternoon, > > > > > > In PostgreSQL 9.5.3 I have created a function (full source code at the > bottom), which goes throu

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 15:42 GMT+02:00 Pavel Stehule : > > > 2016-08-10 15:39 GMT+02:00 Alexander Farber : > >> >> Thank you - >> >> On Wed, Aug 10, 2016 at 3:18 PM, Charles Clavadetscher < >> clavadetsc...@swisspug.org> wrote: >> >>> >>> #variable_conflict [use_column|use_variable] before BEGIN: >>> >>> - ht

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread David G. Johnston
On Wed, Aug 10, 2016 at 9:39 AM, Alexander Farber < alexander.far...@gmail.com> wrote: > > ERROR: query has no destination for result data > HINT: If you want to discard the results of a SELECT, use PERFORM instead. > CONTEXT: PL/pgSQL function words_check_words(integer,integer,jsonb) line > 13

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Pavel Stehule
2016-08-10 15:39 GMT+02:00 Alexander Farber : > > Thank you - > > On Wed, Aug 10, 2016 at 3:18 PM, Charles Clavadetscher < > clavadetsc...@swisspug.org> wrote: > >> >> #variable_conflict [use_column|use_variable] before BEGIN: >> >> - http://dba.stackexchange.com/questions/105831/naming-conflic >>

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
Thank you - On Wed, Aug 10, 2016 at 3:18 PM, Charles Clavadetscher < clavadetsc...@swisspug.org> wrote: > > #variable_conflict [use_column|use_variable] before BEGIN: > > - http://dba.stackexchange.com/questions/105831/naming- > conflict-between-function-parameter-and-result-of-join-with-using-cl

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Adrian Klaver
On 08/10/2016 05:54 AM, Alexander Farber wrote: Good afternoon, In PostgreSQL 9.5.3 I have created a function (full source code at the bottom), which goes through an 15 x 15 varchar array and collects words played horizontally and vertically. I have declared the function as: CREATE OR REPLACE

Re: [GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Charles Clavadetscher
Hello > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Alexander Farber > Sent: Mittwoch, 10. August 2016 14:54 > To: pgsql-general > Subject: [GENERAL] RETURNS TABLE function: ERROR: column r

[GENERAL] RETURNS TABLE function: ERROR: column reference "word" is ambiguous

2016-08-10 Thread Alexander Farber
Good afternoon, In PostgreSQL 9.5.3 I have created a function (full source code at the bottom), which goes through an 15 x 15 varchar array and collects words played horizontally and vertically. I have declared the function as: CREATE OR REPLACE FUNCTION words_check_words( IN in_uid inte