[GENERAL] How to parse xml containing optional elements

2016-08-10 Thread Andrus
SEPA ISO XML transactions file needs to be parsed into flat table in Postgres 9.1+ in ASP:NET 4.6 MVC controller. I tried code below but this produces wrong result: tasusumma orderinr 150.00 PV04131 0.38 PV04131 Since there is no EndToEnd in second row there should be null in secon

Re: [GENERAL] PK Index - Removal

2016-08-10 Thread Venkata Balaji N
On Thu, Aug 11, 2016 at 1:30 PM, Patrick B wrote: > Hi guys, > > I got the following index: > > CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text")) > > > The "ID" is my primary key: > >> "mo_pkey" PRIMARY KEY, "btree" ("id") > > > The ix_mo_pk index is not being used... But as it ha

Re: [GENERAL] PK Index - Removal

2016-08-10 Thread Andreas Kretschmer
Yes, you can drop the unused index. On 11 August 2016 05:30:15 CEST, Patrick B wrote: >Hi guys, > >I got the following index: > >CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text")) > > >The "ID" is my primary key: > >> "mo_pkey" PRIMARY KEY, "btree" ("id") > > >The ix_mo_pk index is

Re: [GENERAL] PK Index - Removal

2016-08-10 Thread Adrian Klaver
On 08/10/2016 08:30 PM, Patrick B wrote: Hi guys, I got the following index: CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text")) The "ID" is my primary key: "mo_pkey" PRIMARY KEY, "btree" ("id") The ix_mo_pk index is not being used... But as it has the "ID" on it, I w

[GENERAL] PK Index - Removal

2016-08-10 Thread Patrick B
Hi guys, I got the following index: CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text")) The "ID" is my primary key: > "mo_pkey" PRIMARY KEY, "btree" ("id") The ix_mo_pk index is not being used... But as it has the "ID" on it, I wanted to ask before dropping it. Can you guys ex

Re: [GENERAL] Jsonb extraction very slow

2016-08-10 Thread Jim Nasby
On 8/9/16 9:29 AM, Tom Lane wrote: "hari.prasath" writes: I am using jsonb for storing key-value pair information(500 keys) and it was a very big data set with some 10M rows. Whenever i try to extract some keys(let say some 10 keys and its values) its really very slow. Is this due to jso

Re: [GENERAL] Any reasons for 'DO' statement not returning result?

2016-08-10 Thread Jim Nasby
On 8/8/16 7:25 PM, Xtra Coder wrote: With some former experience with MsSQL server, where 'complex' script is executed easily and straightforward without any 'wrapping', like this dummy-one ... DECLARE @a int; DECLARE @b int; ... select @a + @b as "a+b" ... every time I need to

Re: [GENERAL] plpython.h not installed in 9.4

2016-08-10 Thread Tom Lane
Jim Nasby writes: > 9.5+ installs plpython.h under include/server. 9.4 apparently doesn't. > I'm guessing that changed in 9.5? Or am I doing something wrong? Looks like it was added rather unceremoniously in cac76582, most likely to allow out-of-tree builds of plpython transform modules.

[GENERAL] plpython.h not installed in 9.4

2016-08-10 Thread Jim Nasby
9.5+ installs plpython.h under include/server. 9.4 apparently doesn't. I'm guessing that changed in 9.5? Or am I doing something wrong? -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://

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

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

2016-08-10 Thread Adrian Klaver
On 08/10/2016 11:26 AM, Alexander Farber wrote: 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? Given what you are doing, RETURN TABLE it will not work there for

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] Should a DB vacuum use up a lot of space ?

2016-08-10 Thread Jeff Janes
On Mon, Aug 8, 2016 at 12:08 AM, Philippe Girolami wrote: >>Not understanding; 'the auto-vacuum daemon kicks in and burns through >>the transactions'. >>Are you saying it is reclaiming xids for you or using them? >>If reclaiming that is what is supposed to do and is good thing. >>Or am I misunder

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
2016-08-10 15:18 GMT+02:00 Charles Clavadetscher : > Hello > > > -Original Message- > > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-owner@ > postgresql.org] On Behalf Of Alexander Farber > > Sent: Mittwoch, 10. August 2016 14:54 > > To: pgsql-general > > Subject: [GENER

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 reference "word" is >

[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

Re: [GENERAL] Logical Decoding Failover

2016-08-10 Thread Simon Riggs
On 10 August 2016 at 09:03, Colin Morelli wrote: > That's too bad. Logical decoding is incredibly powerful, but if it > ultimately comes down to picking between HA or logical decoding the choice > to use it becomes a lot more difficult. Agreed. > Are you saying that logical decoding is receivin

Re: [GENERAL] Logical Decoding Failover

2016-08-10 Thread Colin Morelli
Simon, That's too bad. Logical decoding is incredibly powerful, but if it ultimately comes down to picking between HA or logical decoding the choice to use it becomes a lot more difficult. Are you saying that logical decoding is receiving a different design in 10.0? (For clarify - is 10.0 the nex

Re: [GENERAL] Logical Decoding Failover

2016-08-10 Thread Simon Riggs
On 6 August 2016 at 04:17, Colin Morelli wrote: > I'm using logical decoding in my application to capture change streams and > ship them to Kafka. However, logical replication slots aren't included in > the WAL and thus don't make it to replicas. In the case of a failover, it's > not clear what (