Re: [GENERAL] Returning JSON or JSONB

2015-10-20 Thread Andreas Kretschmer
Dane Foster wrote: > Hello, > > I was wondering when returning JSON data from a PostgreSQL function for > consumption by clients (e.g., PHP or Lua) does it make any difference to > declare the function's return type as JSON or JSONB? JSONB is only for internal storage, for external representati

[GENERAL] RAID and SSD configuration question

2015-10-20 Thread Birta Levente
Hi I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap module (BTR-TFM8G-LSICVM02) - 2x300GB 10k spin drive, as raid 1 (OS) - 2x300GB 15k spin drive, as raid 1 (for xlog) - 2x200GB Intel DC S3710 SSD (for DB), as raid 1 So how is better for the SSDs: mdraid or controller's rai

Re: [GENERAL] interperting type oid in C code

2015-10-20 Thread Albe Laurenz
Ken Been wrote: > I'm working on a foreign data wrapper and I want to switch based on the > column type. > Specifically, if the column type in the external table is the same as in the > (locally defined) foreign > table then I can get some speedup for some types. > > Through the ForeignScanState

Re: [GENERAL] PSQL Tools

2015-10-20 Thread Nicolas Paris
Yes, moreover it provides SQL auto-completion (ctrl+space), query history, The eclipse workbench is easy, fast & reactiv. Hope I had kown DBeaver before 2015-10-19 14:49 GMT+02:00 Yves Dorfsman : > On 2015-10-18 16:37, Nicolas Paris wrote: > > > > ​I didn't know DBeaver, it looks great ! (I pers

[GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread Tim van der Linden
Hi All I have a question regarding PostgreSQL's full text capabilities and (presumably) the synonym dictionary. I'm currently implementing FTS on a medical themed setup which uses domain specific jargon to denote a bunch of stuff. A specific request I wish to implement here are the jargon syno

Re: [GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread rob stone
On Tue, 2015-10-20 at 19:35 +0900, Tim van der Linden wrote: > Hi All > > I have a question regarding PostgreSQL's full text capabilities and > (presumably) the synonym dictionary. > > I'm currently implementing FTS on a medical themed setup which uses > domain specific jargon to denote a bunch o

Re: [GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread Geoff Winkless
On 20 October 2015 at 11:35, Tim van der Linden wrote: > Of course, I can simply go ahead and create my own synonym dictionary with > a jargon specific synonym file to feed it. However, most of the synonyms > are comprised out of more then a single word. > ​ ​Does the Thesaurus dictionary not do

Re: [GENERAL] ERROR: tablespace "archive2" is not empty

2015-10-20 Thread Adrian Klaver
On 10/20/2015 12:22 AM, Josip Rodin wrote: On Mon, Oct 19, 2015 at 12:02:17PM -0700, Adrian Klaver wrote: No idea, I inherited this machine. But like Tom said, spclocation being wrong is apparently harmless. Other then you cannot DROP the tablespace:) This will probably needed to be resolved f

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente wrote: > Hi > > I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap module > (BTR-TFM8G-LSICVM02) > - 2x300GB 10k spin drive, as raid 1 (OS) > - 2x300GB 15k spin drive, as raid 1 (for xlog) > - 2x200GB Intel DC S3710 SSD (for DB), as

Re: [GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread Kevin Grittner
On Tuesday, October 20, 2015 6:05 AM, Geoff Winkless wrote: > On 20 October 2015 at 11:35, Tim van der Linden wrote: >> Of course, I can simply go ahead and create my own synonym >> dictionary with a jargon specific synonym file to feed it. However, >> most of the synonyms are comprised out of m

[GENERAL] Escaping text / hstore

2015-10-20 Thread pinker
Maybe somebody have an idea how to escape text string for use in hstore column? I have tried $$ and quote_literal in audit trigger function, but still db won't let me pass values with // or ' to the hstore...INSERT FROM trigger function: EXECUTE 'INSERT INTO history.' || TG_TABLE_SCHEMA || '_'

Re: [GENERAL] Escaping text / hstore

2015-10-20 Thread hubert depesz lubaczewski
On Tue, Oct 20, 2015 at 07:00:04AM -0700, pinker wrote: > Maybe somebody have an idea how to escape text string for use in hstore > column? I have tried $$ and quote_literal in audit trigger function, but > still db won't let me pass values with // or ' to the hstore...INSERT FROM > trigger functio

Re: [GENERAL] Escaping text / hstore

2015-10-20 Thread Adrian Klaver
On 10/20/2015 07:00 AM, pinker wrote: Maybe somebody have an idea how to escape text string for use in hstore column? I have tried $$ and quote_literal in audit trigger function, but still db won't let me pass values with // or ' to the hstore... INSERT FROM trigger function: EXECUTE 'INSER

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Scott Marlowe
On Tue, Oct 20, 2015 at 7:30 AM, Merlin Moncure wrote: > On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente wrote: >> Hi >> >> I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap module >> (BTR-TFM8G-LSICVM02) >> - 2x300GB 10k spin drive, as raid 1 (OS) >> - 2x300GB 15k spin drive, a

[GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
Hello, I'm in the very very very very early stages of migrating a MySQL/PHP app to PostgreSQL/PHP/Lua. Because we are moving to PostgreSQL one of the [many] things I intend to change is to move ALL the SQL code/logic out of the application layer and into the database where it belongs. So after mon

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Tomas Vondra
Hi, On 10/20/2015 03:30 PM, Merlin Moncure wrote: On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente wrote: Hi I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap module (BTR-TFM8G-LSICVM02) - 2x300GB 10k spin drive, as raid 1 (OS) - 2x300GB 15k spin drive, as raid 1 (for xlog) -

Re: [GENERAL] Escaping text / hstore

2015-10-20 Thread pinker
Adrian Klaver-4 wrote > Here is my very similar function: > > CREATE OR REPLACE FUNCTION utility.archive_del_record() RETURNS trigger AS > $BODY$ > DECLARE > tbl_name text := TG_TABLE_NAME || '_delete' ; > archive_row hstore := hstore(OLD.*); > user_name text := session_user; > BEGI

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Pavel Stehule
2015-10-20 16:45 GMT+02:00 Dane Foster : > Hello, > > I'm in the very very very very early stages of migrating a MySQL/PHP app > to PostgreSQL/PHP/Lua. Because we are moving to PostgreSQL one of the > [many] things I intend to change is to move ALL the SQL code/logic out of > the application layer

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Tomas Vondra
Hi, On 10/20/2015 04:33 PM, Scott Marlowe wrote: We're running LSI MegaRAIDs at work with 10 SSD RAID-5 arrays, and we can get ~5k to 7k tps on a -s 1 pgbench with the write cache on. When we turn the write cache off, we get 15k to 20k tps. This is on a 120GB pgbench db that fits in memory

Re: [GENERAL] ERROR: tablespace "archive2" is not empty

2015-10-20 Thread Josip Rodin
On Mon, Oct 19, 2015 at 12:02:17PM -0700, Adrian Klaver wrote: > >No idea, I inherited this machine. But like Tom said, spclocation being > >wrong is apparently harmless. > > Other then you cannot DROP the tablespace:) This will probably > needed to be resolved for the reasons that came up in this

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 10:14 AM, Tomas Vondra wrote: > Hi, > > On 10/20/2015 03:30 PM, Merlin Moncure wrote: >> >> On Tue, Oct 20, 2015 at 3:14 AM, Birta Levente >> wrote: >>> >>> Hi >>> >>> I have a supermicro SYS-1028R-MCTR, LSI3108 integrated with SuperCap >>> module >>> (BTR-TFM8G-LSICVM02)

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 9:45 AM, Dane Foster wrote: > Hello, > > I'm in the very very very very early stages of migrating a MySQL/PHP app to > PostgreSQL/PHP/Lua. Because we are moving to PostgreSQL one of the [many] > things I intend to change is to move ALL the SQL code/logic out of the > applic

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Scott Marlowe
> On Tue, Oct 20, 2015 at 9:33 AM, Scott Marlowe > wrote: >> We're running LSI MegaRAIDs at work with 10 SSD RAID-5 arrays, and we >> can get ~5k to 7k tps on a -s 1 pgbench with the write cache on. >> >> When we turn the write cache off, we get 15k to 20k tps. This is on a >> 120GB pgbench d

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
On Tue, Oct 20, 2015 at 12:43 PM, Merlin Moncure wrote: > On Tue, Oct 20, 2015 at 9:45 AM, Dane Foster wrote: > > Hello, > > > > I'm in the very very very very early stages of migrating a MySQL/PHP app > to > > PostgreSQL/PHP/Lua. Because we are moving to PostgreSQL one of the [many] > > things

[GENERAL] Configurable length of application_name and/or read access to custom gucs of another backend

2015-10-20 Thread Vladimir Sitnikov
Hi, I want to instrument database connections with app module/action/username/transaction id/etc. The main use case is for troubleshooting purposes: 1) I want some kind of report from the database (e.g. select * from pg_stat_activitiy) to show not just SQL texts, but application modules/components

Re: [GENERAL] RAID and SSD configuration question

2015-10-20 Thread Merlin Moncure
On Tue, Oct 20, 2015 at 12:28 PM, Scott Marlowe wrote: >> On Tue, Oct 20, 2015 at 9:33 AM, Scott Marlowe >> wrote: >>> We're running LSI MegaRAIDs at work with 10 SSD RAID-5 arrays, and we >>> can get ~5k to 7k tps on a -s 1 pgbench with the write cache on. >>> >>> When we turn the write cac

Re: [GENERAL] Returning JSON or JSONB

2015-10-20 Thread Vick Khera
On Tue, Oct 20, 2015 at 4:04 AM, Andreas Kretschmer < akretsch...@spamfence.net> wrote: > If you are returning JSON, so is JSON the best choice. > The JSONB type represented as text (i.e., when you query it) is valid JSON. The same with JSON data type. The DB server renders the data as text when

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
Here is the updated version w/ the feedback incorporated. I'm going to install PostgreSQL 9.6 from source this weekend so I can start testing/debugging. Does anyone here have any experience using the pgAdmin debugger recently? I ask because it seems a little dated (September 26, 2008). Thanks, D

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread John R Pierce
On 10/20/2015 1:22 PM, Dane Foster wrote: Here is the updated version w/ the feedback incorporated. I'm going to install PostgreSQL 9.6 from source this weekend so I can start testing/debugging. I would stick with developing/debugging on the current release version, 9.4. 9.6 isn't even in

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Pavel Stehule
2015-10-20 22:22 GMT+02:00 Dane Foster : > Here is the updated version w/ the feedback incorporated. I'm going to > install PostgreSQL 9.6 from source this weekend so I can start > testing/debugging. Does anyone here have any experience using the pgAdmin > debugger recently? I ask because it seems

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
On Tue, Oct 20, 2015 at 4:35 PM, John R Pierce wrote: > On 10/20/2015 1:22 PM, Dane Foster wrote: > >> Here is the updated version w/ the feedback incorporated. I'm going to >> install PostgreSQL 9.6 from source this weekend so I can start >> testing/debugging. >> > > I would stick with developin

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Jim Nasby
On 10/20/15 11:43 AM, Merlin Moncure wrote: *) let's compare notes on your doxygen style code markup. I've been trouble finding a good robust tool that does exactly what I want, curious if you did better. Related to that (I think), you might want to move the documentation out of the comment bl

Re: [GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread Tim van der Linden
On Tue, 20 Oct 2015 21:57:59 +1100 rob stone wrote: > > Looking at this from an entirely different perspective, why are you not > using ICD codes to identify patient events? > It is a one to many relationship between patient and their events > identified by the relevant ICD code and date. > Given

Re: [GENERAL] Multiple word synonyms (maybe?)

2015-10-20 Thread Tim van der Linden
On Tue, 20 Oct 2015 12:02:46 +0100 > ​Does the Thesaurus dictionary not do what you want?​ > ​ > http://www.postgresql.org/docs/current/static/textsearch-dictionaries.html#TEXTSEARCH-THESAURUS Damn, I completely overlooked that one, and it indeed does seem to come very close to what I need in th

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
On Tue, Oct 20, 2015 at 5:53 PM, Jim Nasby wrote: > On 10/20/15 11:43 AM, Merlin Moncure wrote: > >> *) let's compare notes on your doxygen style code markup. I've been >> trouble finding a good robust tool that does exactly what I want, >> curious if you did better. >> > > Related to that (I thi

Re: [GENERAL] My first PL/pgSQL function

2015-10-20 Thread Dane Foster
Since I'm switching to OUT parameters is there any difference (performance/efficiency wise) between using an INTO STRICT RECORD_TYPE_VARIABLE statement which forces me to copy/assign the property values from the RECORD to the OUT parameter variables and simply listing the OUT parameters, i.e., INTO

[GENERAL] trouble downloading postgres 9.4 for RHEL 6.x

2015-10-20 Thread anj patnaik
Several weeks ago, I successfully downloaded postgresql-9.4.4-3-linux-x64.run on a Linux server. Today, I attempted to download from the site. I notice 9.5 is there, but getting lots of errors: 1) when downloading and running latest rchive: /home/apatnaik/Downloads/postgresql-9.4.5-1-windows-x6

Re: [GENERAL] trouble downloading postgres 9.4 for RHEL 6.x

2015-10-20 Thread John R Pierce
On 10/20/2015 5:48 PM, anj patnaik wrote: What is the recommended 9.4 version to download from and the steps? *I* recommend... # yum install -y http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm # yum install -y postgresql94-{server,contrib,devel} #