Re: [GENERAL] Postgresql-fdw

2016-05-23 Thread Rader, David
On Mon, May 23, 2016 at 1:52 AM, aluka raju wrote: I have data storage in flat files (structured and unstructured) . I want to run sql queries on that , so i am looking in to postgresql how to use fdw on the data that i have. You could use the file_fdw to "attach" the

[GENERAL] FIRST_VALUE: need to group by argument?

2016-05-23 Thread Guyren Howe
I am missing something here. I have two tables: orders id delivery_route_segments id, order_id, position, completed I want to find the first uncompleted deliver_route_segment for each order, by position. Seems to me I ought to be able to do this:

Re: [GENERAL] Unused indexes - PostgreSQL 9.2

2016-05-23 Thread Melvin Davidson
Here is the url which explains the columns in pg_stat_all_indexes view http://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-ALL-INDEXES-VIEW On Mon, May 23, 2016 at 8:42 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, May 23, 2016 at 8:33 PM, Lucas

Re: [GENERAL] Unused indexes - PostgreSQL 9.2

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 8:33 PM, Lucas Possamai wrote: > > > On 24 May 2016 at 12:18, Jeff Janes wrote: > >> On Mon, May 23, 2016 at 4:23 PM, Lucas Possamai >> wrote: >> > >> > That index has been added just 3 hours ago, and you

Re: [GENERAL] Unused indexes - PostgreSQL 9.2

2016-05-23 Thread Lucas Possamai
On 24 May 2016 at 12:18, Jeff Janes wrote: > On Mon, May 23, 2016 at 4:23 PM, Lucas Possamai > wrote: > > > > That index has been added just 3 hours ago, and you can see that the > > times_used goes over 41000 How is that possible?? > > Well, that

Re: [GENERAL] Unused indexes - PostgreSQL 9.2

2016-05-23 Thread Jeff Janes
On Mon, May 23, 2016 at 4:23 PM, Lucas Possamai wrote: > > That index has been added just 3 hours ago, and you can see that the > times_used goes over 41000 How is that possible?? Well, that is what it is there for, right , to be used? My ancient laptop can use an

Re: [GENERAL] Fatal error "stack empty" on ROLLBACK

2016-05-23 Thread dandl
Hi Tom You're very diligent at making sure queries get answered, and I appreciate that. Yes, this one was indeed my bug (the message comes from deep inside dotnet), triggered by the unexpected error result code. False alarm. Thanks for the suggestions. Regards David M Bennett FACS Andl - A

Re: [GENERAL] Unused indexes - PostgreSQL 9.2

2016-05-23 Thread Lucas Possamai
Hello Melvin, how are you doing? >> > And what happens if you run this query? > > SELECT idstat.schemaname AS schema, >idstat.relname AS table_name, >indexrelname AS index_name, >idstat.idx_scan AS times_used, >

Re: [GENERAL] Increased I/O / Writes

2016-05-23 Thread Lucas Possamai
On 24 May 2016 at 09:40, Kevin Grittner wrote: > On Mon, May 23, 2016 at 4:32 PM, Lucas Possamai > wrote: > > > The spikes were happening because, after the reboot, the HUGE PAGES were > > enabled. > > > > After disabling them, all got back to normal. >

Re: [GENERAL] Increased I/O / Writes

2016-05-23 Thread Kevin Grittner
On Mon, May 23, 2016 at 4:32 PM, Lucas Possamai wrote: > The spikes were happening because, after the reboot, the HUGE PAGES were > enabled. > > After disabling them, all got back to normal. Since you said earlier you were on PostgreSQL version 9.2, you must be talking

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-23 Thread Lucas Possamai
Just an update here: IF (TG_OP = 'INSERT') THEN > UPDATE public.companies SET client_code_increment = > (client_code_increment + 1) WHERE id = NEW.company_id; The line above was updating the client_code_increment even if the customer was inserting data by hiimself, which is wrong. The

Re: [GENERAL] index on ILIKE/LIKE - PostgreSQL 9.2

2016-05-23 Thread Lucas Possamai
Hi there, The problem was solved by using lowercase *New index:* > CREATE INDEX CONCURRENTLY ON public.ja_jobs (clientid, lower(title) > varchar_pattern_ops, time_job); *New query:* > SELECT DISTINCT title > FROM public.ja_jobs WHERE lower(title) LIKE lower('RYAN > WER') >

Re: [GENERAL] Connections - Postgres 9.2

2016-05-23 Thread Lucas Possamai
On 17 May 2016 at 22:24, Sridhar N Bamandlapally wrote: > Hi > > I control this way > > if "state_change" is from longtime and "state" is idle then I use > > function: > *pg_terminate_backend ( integer ) * ==> return TRUE if > killed-successful else FALSE > > example: >

Re: [GENERAL] Increased I/O / Writes

2016-05-23 Thread Lucas Possamai
Just an update about this... As you know, the server was rebooted. The spikes were happening because, after the reboot, the HUGE PAGES were enabled. After disabling them, all got back to normal. Cheers

Re: [GENERAL] postgres 9.5 create function plpthon3u resets connections to server

2016-05-23 Thread Adrian Klaver
On 05/23/2016 01:42 PM, Peter Crosbie wrote: Adrian, many thanks for picking this up. Going back to get the link for the installation download, I notice the "readme.txt" link next to the installer. Looking at that file for the first time, it clearly lays out how to include the language packs

Re: [GENERAL] postgres 9.5 create function plpthon3u resets connections to server

2016-05-23 Thread Peter Crosbie
Adrian, many thanks for picking this up. Going back to get the link for the installation download, I notice the "readme.txt" link next to the installer. Looking at that file for the first time, it clearly lays out how to include the language packs including plpython. After following the

Re: [GENERAL] postgres 9.5 create function plpthon3u resets connections to server

2016-05-23 Thread Adrian Klaver
On 05/23/2016 11:18 AM, Peter Crosbie wrote: this is a repost of a message I mistakenly sent to pgslq-novice, although it is probably a simple question I believe my issue may be that I don't have the correct python interpreter on the server's path. I couldn't find the required version in the

[GENERAL] postgres 9.5 create function plpthon3u resets connections to server

2016-05-23 Thread Peter Crosbie
this is a repost of a message I mistakenly sent to pgslq-novice, although it is probably a simple question I believe my issue may be that I don't have the correct python interpreter on the server's path. I couldn't find the required version in the documents and determined what I thought was

Re: [GENERAL] Fatal error "stack empty" on ROLLBACK

2016-05-23 Thread Tom Lane
"dandl" writes: > SPI call to execute "ROLLBACK" triggers FATAL ERROR "stack empty". What does > it mean? Nothing in the docs I can see. I can't find that string anywhere in the Postgres sources. However, SPI should refuse to execute ROLLBACK, or any other transaction control

Re: [GENERAL] pg_basebackup: return value 1: reason?

2016-05-23 Thread Andrej Vanek
Hello, I've given a try once again. Two variants used in my script (launched by crm_mon): 1. /usr/pgsql-9.5/bin/pg_basebackup -U pgreplic -h db-other-site -w -D /opt/geo_stdby_data -c fast -vvv -X stream &>> /tmp/log 2. strace -o /tmp/pg_basebackup.log /usr/pgsql-9.5/bin/pg_basebackup -U pgreplic

Re: [GENERAL] Postgresql-fdw

2016-05-23 Thread Bruno Wolff III
On Sun, May 22, 2016 at 23:38:43 -0700, John R Pierce wrote: If you want to use postgres to query this data efficiently, you really should import this data into postgres tables, properly indexed for the sorts of queries you wish to do. And it isn't that hard to script

Re: [GENERAL] revert function for to_json ?

2016-05-23 Thread Marc Mamin
>From: pgsql-general-ow...@postgresql.org >[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Marc Mamin >Sent: Montag, 23. Mai 2016 16:03 >To: pgsql-general@postgresql.org >Subject: [GENERAL] revert function for to_json ? > >Hello, > >I'm looking for $subject > >example: > >how to

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 9:17 AM, Albe Laurenz wrote: > David G. Johnston wrote: > > On Mon, May 23, 2016 at 6:54 AM, aluka raju > wrote: > >> As given in the FAQ's that postgresql cannot be embedded > >>

[GENERAL] revert function for to_json ?

2016-05-23 Thread Marc Mamin
Hello, I'm looking for $subject example: how to revert select to_json(E'a\n''b'::text) I can achieve it with something like this: select json_extract_path_text(('{"a":'||to_json(E'a\n''b'::text)||'}')::json,'a') does anybody knows a less ugly solution ? regards, Marc Mamin

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread Scott Mead
On Mon, May 23, 2016 at 9:51 AM, Adrian Klaver wrote: > On 05/23/2016 03:54 AM, aluka raju wrote: > >> >> Hello, >> >> As given in the FAQ's that postgresql cannot be >> embedded >> https://wiki.postgresql.org/wiki/FAQ#Can_PostgreSQL_be_embedded.3F . >> >> Is their any

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread Adrian Klaver
On 05/23/2016 03:54 AM, aluka raju wrote: Hello, As given in the FAQ's that postgresql cannot be embedded https://wiki.postgresql.org/wiki/FAQ#Can_PostgreSQL_be_embedded.3F . Is their any possibility to make it embedded. Till now postgresql has not done this embedded mode and i want to work

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread Jan de Visser
On Monday, May 23, 2016 1:17:13 PM EDT Albe Laurenz wrote: > David G. Johnston wrote: > > > On Mon, May 23, 2016 at 6:54 AM, aluka raju > > wrote: > > >> As given in the FAQ's that postgresql cannot be embedded > >>

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread Albe Laurenz
David G. Johnston wrote: > On Mon, May 23, 2016 at 6:54 AM, aluka raju wrote: >> As given in the FAQ's that postgresql cannot be embedded >> https://wiki.postgresql.org/wiki/FAQ#Can_PostgreSQL_be_embedded.3F . >> >> Is their any possibility to make it embedded. Till now

Re: [GENERAL] postgresql embedded mode

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 6:54 AM, aluka raju wrote: > > Hello, > > As given in the FAQ's that postgresql cannot be embedded > https://wiki.postgresql.org/wiki/FAQ#Can_PostgreSQL_be_embedded.3F . > > Is their any possibility to make it embedded. Till now postgresql has not

[GENERAL] postgresql embedded mode

2016-05-23 Thread aluka raju
Hello, As given in the FAQ's that postgresql cannot be embedded https://wiki.postgresql.org/wiki/FAQ#Can_PostgreSQL_be_embedded.3F . Is their any possibility to make it embedded. Till now postgresql has not done this embedded mode and i want to work on how it can be embedded and contribute.

Re: [GENERAL] Postgresql-fdw

2016-05-23 Thread John R Pierce
On 5/22/2016 10:52 PM, aluka raju wrote: I have data storage in flat files (structured and unstructured) . I want to run sql queries on that , so i am looking in to postgresql how to use fdw on the data that i have. I want to prepare an api for running sql queries for the data in files,so i am

Re: [GENERAL] Postgresql-fdw

2016-05-23 Thread Arthur Silva
You can build a multicorn fdw http://multicorn.org/ Regards On May 23, 2016 7:54 AM, "aluka raju" wrote: > > I have data storage in flat files (structured and unstructured) . I want to run sql queries on that , so i am looking in to postgresql how to use fdw on the data