Re: [GENERAL] installation problems on OSX Lion

2011-07-23 Thread Sean Moss-Pultz
On Sun, Jul 24, 2011 at 2:29 PM, Darren Duncan wrote: > If you're using the bleeding edge anyway with Lion, why not use Postgres > 9.0.4 with it, which is also on that page?  Or at least see if it works > where you got this 8.4 error.  I have nothing to suggest otherwise. -- Thanks for the reply.

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Sim Zacks
I gave a talk on using postgresql as an application server at PG East in March. Basically, we try to implement all business logic using functions, using plpythonu when necessary. For example, we have functions that send email, ftp files, sync remote databases, etc. It is important to kee

Re: [GENERAL] installation problems on OSX Lion

2011-07-23 Thread Darren Duncan
If you're using the bleeding edge anyway with Lion, why not use Postgres 9.0.4 with it, which is also on that page? Or at least see if it works where you got this 8.4 error. I have nothing to suggest otherwise. -- Darren Duncan Sean Moss-Pultz wrote: Hi list After installing PostgreSQL (8.4

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Chris Travers
> I was thinking similar thoughts, but you not only beat me to it, you made > some good points I had not thought of! > > The only thing I can think of adding: is that it would be good to lock down > the database so that only the middleware can access it, everything else > accesses the database via

[GENERAL] installation problems on OSX Lion

2011-07-23 Thread Sean Moss-Pultz
Hi list After installing PostgreSQL (8.4.8-1) from: http://www.enterprisedb.com/products-services-training/pgdownload#osx on OSX Lion, when running psql I get the following error: dyld: Library not loaded: /usr/lib/libpq.5.dylib Referenced from: /usr/bin/psql Reason: no suitable image f

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
thanks for all the help! @Adrian: yes, only one instance on each machine not the slave finally started and could be connect, replication didn't begin, just following errors: https://gist.github.com/1102225 BTW: is that possible that rsync has finished but the data didn't flush to disk, so w

Re: [GENERAL] [SQL] 500KB PDF files for postgresql8.3, which is the most efficient way?

2011-07-23 Thread Enrico Weigelt
* Emi Lu wrote: > Solution: > > (1) Save pdfs to file system, only point file name in psql8.3 > > (2) Save oids of pdfs into table > > (3) Save pdf files as bytea column in psql8.3 (4) Put them into an object store, eg. venti. cu -- -

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Scott Ribe
On Jul 23, 2011, at 8:43 PM, Yan Chunlu wrote: > I used apt-get to install postgresql, running pg_config showing they > are exactly the same... BTW, forgot to mention this in my first message: I run streaming replication across the country with latency well over 100ms and no problems. -- Scott

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Scott Marlowe
On Sat, Jul 23, 2011 at 8:53 PM, Yan Chunlu wrote: > the system date formats? looks the same: hehe, no, the internal formats. There's a floating point and an integer method. They have to be the same and according to your output of pg_config they are, with this config flag listed for both: --en

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
the system date formats? looks the same: master: #date Sat Jul 23 21:53:34 CDT 2011 slave: #date Sat Jul 23 21:52:56 CDT 2011 On Sun, Jul 24, 2011 at 2:44 AM, Scott Marlowe wrote: > On Sat, Jul 23, 2011 at 11:55 AM, Tomas Vondra wrote: >> On 23 Červenec 2011, 18:14, Yan Chunlu wrote: >>> tha

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Adrian Klaver
On Saturday, July 23, 2011 7:43:56 pm Yan Chunlu wrote: > I used apt-get to install postgresql, running pg_config showing they > are exactly the same... > > > running on master: > https://gist.github.com/1102148 > > > running on slave: > https://gist.github.com/1102151 > Are you sure there is

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
less postgres didn't showing anything... cause it's binary, I tried with -a less postgres |grep -a ELF less postgres | grep -a Class nothing related to (ELF32 => 32bit, ELF64 => 64bit). On Sun, Jul 24, 2011 at 1:55 AM, Tomas Vondra wrote: > On 23 Červenec 2011, 18:14, Yan Chunlu wrote: >>

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
I used apt-get to install postgresql, running pg_config showing they are exactly the same... running on master: https://gist.github.com/1102148 running on slave: https://gist.github.com/1102151 On Sun, Jul 24, 2011 at 2:44 AM, Scott Marlowe wrote: > On Sat, Jul 23, 2011 at 11:55 AM, Tomas Von

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Gavin Flower
On 23/07/11 12:05, John R Pierce wrote: On 07/22/11 4:11 PM, Darren Duncan wrote: Karl Nack wrote: I've been following a few blogs (http://database-programmer.blogspot.com/, http://thehelsinkideclaration.blogspot.com/) that make a very compelling argument, in my opinion, to move as much busine

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Karl Nack
> > SELECT create_transaction(1, current_date, 'Transaction 1', ((1, > > 50), (2, -50))); > > Well, not quite, because specifying the number "50" twice would be > ridiculous for such a non-generic function; you can calculate the "- > 50" from it in the function. Not if there were more than two lin

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Karl Nack
> In LedgerSMB, we take this a step further by making the procedures > into discoverable interfaces, so the application logic itself is a > sort of thin glue between a UI layer and the database procedure layer. > One thing I would suggest is to try to keep API calls as atomic as > possible. You w

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Karl Nack
> For example, you could use XML to describe the > data (I'm no fan of XML, but it does suit a need here and allows > validation of the provided data), especially as Postgres has XML parsing > functionality. Would you go so far as to suggest making the entire parameter an XML statement, something

Re : [GENERAL] Update columns in same table from update trigger?

2011-07-23 Thread Pablo Romero Abiti
Hi Alban, thank's for your reply. I already changed it as you wrote, but I'm still having the problem that the trigger won't execute unless the value specified for idcolor in table warehouse does exist. Shouldn't the trigger execute BEFORE the update process? Regards, Pablo _

Re: [GENERAL] Locking several tables within one transaction

2011-07-23 Thread Ilia Lilov
Thank you, Scott. I wondered about it, actually. I've found perfect (I believe) solution. It uses pg_advisory_lock() as I guessed before, but I thought wrong about it. For some reason I thought session is some kind of scope for advisory lock, so one program can't see locking made by another progra

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Chris Travers
> CREATE OR REPLACE FUNCTION payment_bulk_post > (in_transactions numeric[], in_batch_id int, in_source text, in_total numeric, >        in_ar_ap_accno text, in_cash_accno text, >        in_payment_date date, in_account_class int, in_payment_type int, >        in_exchangerate numeric, in_curr text)

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Chris Travers
On Sat, Jul 23, 2011 at 3:51 PM, Karl Nack wrote: >> In LedgerSMB, we take this a step further by making the procedures >> into discoverable interfaces, so the application logic itself is a >> sort of thin glue between a UI layer and the database procedure layer. >>  One thing I would suggest is t

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread David Johnston
> > I was assuming here that we were dealing with a double-entry accounting > system where every line item in one account had a corresponding line item in > another account of equal magnitude, and so all line items were in pairs, > because you showed what looked like 1 pair, hence specifying t

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Karl Nack
> > Now, if you are doing double-entry bookkeeping this doesn't provide > > enough consistency, IMO. You can't check inside the function to > > ensure that the transaction is balanced. > > One option to consider is restricting final tables but making staging > tables available. I would implement

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Darren Duncan
Karl Nack wrote: SELECT create_transaction(1, current_date, 'Transaction 1', ((1, 50), (2, -50))); Well, not quite, because specifying the number "50" twice would be ridiculous for such a non-generic function; you can calculate the "- 50" from it in the function. Not if there were more than tw

Re: [GENERAL] weird table sizes

2011-07-23 Thread MirrorX
i mentioned the sequences number only b/c it seemed stange and i didnt know if it could be related to the "weird" sizes. now i found something more weird...the autovacuum is ON but on pg_stat_user_tables on this specific table tha last_vacuum and last_autovacuum are both NULL...how can this happen

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Chris Travers
On Sat, Jul 23, 2011 at 1:32 PM, David Johnston wrote: > >> >> Now for the application, you can create an API that is semantically >> clearer.  But PostgreSQL doesn't provide an easy way of calling >> procedures of this sort out of select/update/insert statements and >> select is the only way to d

Re: [GENERAL] weird table sizes

2011-07-23 Thread Adrian Klaver
On Saturday, July 23, 2011 12:18:25 pm MirrorX wrote: > thx for the reply :) > > the table are identical, and i mean that they have the same columns, the > same constraints, the same indexes etc > > 1) the small table(65gb) is on version 8.4.7 and the big one(430gb) on > 8.4.4 2) the small in on

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread David Johnston
> > Now for the application, you can create an API that is semantically > clearer. But PostgreSQL doesn't provide an easy way of calling > procedures of this sort out of select/update/insert statements and > select is the only way to do this. > > A semantically accurate way to run "procedures

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread David Johnston
> > Now, if you are doing double-entry bookkeeping this doesn't provide > enough consistency, IMO. You can't check inside the function to > ensure that the transaction is balanced. it would be better to: > > BEGIN; > SELECT create_transaction(1, current_date, 'Transaction 1', '{{1, 1, > 50},{1

Re: [GENERAL] weird table sizes

2011-07-23 Thread MirrorX
thx for the reply :) the table are identical, and i mean that they have the same columns, the same constraints, the same indexes etc 1) the small table(65gb) is on version 8.4.7 and the big one(430gb) on 8.4.4 2) the small in on Red Hat 4.1.2-50 and the big on Red Hat 4.1.2-46 3) the 2nd was rest

Re: [GENERAL] weird table sizes

2011-07-23 Thread Adrian Klaver
On Saturday, July 23, 2011 11:29:48 am MirrorX wrote: > hello to all > > i would like your help in the following matter -> > > we have 2 identical databases. the 1st was built from scratch while the 2nd > was 'restored' from a dump of another database (without the data). so the > sequences for in

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Scott Marlowe
On Sat, Jul 23, 2011 at 11:55 AM, Tomas Vondra wrote: > On 23 Červenec 2011, 18:14, Yan Chunlu wrote: >> thanks for the help! >> are there any other possible reasons? >> >> both system are using Debian amd64, as uname -a shows: >> Linux washington 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010

[GENERAL] weird table sizes

2011-07-23 Thread MirrorX
hello to all i would like your help in the following matter -> we have 2 identical databases. the 1st was built from scratch while the 2nd was 'restored' from a dump of another database (without the data). so the sequences for instance on the 2nd started from very big numbers. in these databases

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Joshua D. Drake
On 07/23/2011 10:55 AM, Tomas Vondra wrote: On 23 Červenec 2011, 18:14, Yan Chunlu wrote: thanks for the help! are there any other possible reasons? both system are using Debian amd64, as uname -a shows: Linux washington 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 x86_64 GNU/Linux It is

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Tomas Vondra
On 23 Červenec 2011, 18:14, Yan Chunlu wrote: > thanks for the help! > are there any other possible reasons? > > both system are using Debian amd64, as uname -a shows: > Linux washington 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 > x86_64 GNU/Linux It is not just about the architecture, it

Re: [GENERAL] Question about uuid_generate_v3

2011-07-23 Thread Godofredo Contreras
Thank you Adrian for clarifying this. I will use uuid_generate_v1 or uuid_generate_v4 instead of uuid_generate_v3. Regards Godofredo Contreras El 23/07/2011 11:31 a.m., Adrian Klaver escribió: On Saturday, July 23, 2011 8:39:52 am Godofredo Contreras wrote: Hi, First of all, I am new to this

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Chris Travers
On Fri, Jul 22, 2011 at 12:15 PM, Karl Nack wrote: > I've been following a few blogs > (http://database-programmer.blogspot.com/, > http://thehelsinkideclaration.blogspot.com/) that make a very compelling > argument, in my opinion, to move as much business/transactional logic as > possible into th

Re: [GENERAL] Question about uuid_generate_v3

2011-07-23 Thread Adrian Klaver
On Saturday, July 23, 2011 8:39:52 am Godofredo Contreras wrote: > Hi, > > First of all, I am new to this list and I'm not sure if it is the > correct one to post technical questions. If it is not please tell me > which one I should use. > > Recently I installed postgresql 9.1beta3 on a Windows 7

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
thanks for the help! are there any other possible reasons? both system are using Debian amd64, as uname -a shows: Linux washington 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 x86_64 GNU/Linux and using the following program it tells both of them are little-endian #include #include bool

Re: [GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Scott Ribe
On Jul 23, 2011, at 6:50 AM, Yan Chunlu wrote: > what does invalid record length and invalid magic number normally > means? xlog corrupted? > Thanks for any further help! It means your build settings for pg are not compatible across the 2 machines. For instance, one machine is 32-bit and the o

[GENERAL] Question about uuid_generate_v3

2011-07-23 Thread Godofredo Contreras
Hi, First of all, I am new to this list and I'm not sure if it is the correct one to post technical questions. If it is not please tell me which one I should use. Recently I installed postgresql 9.1beta3 on a Windows 7 machine to start testing uuid generation. I correctly installed the funct

[GENERAL] streaming replication does not work across datacenter with 20ms latency?

2011-07-23 Thread Yan Chunlu
I was doing postgresql streaming replication, which was fine when two machine in the same datecenter. but recently I was planning to deploy new slave at a different datecent, the latency between the master and slave is 20ms; below is the related configurateion: Both master and slave have below conf

Re: [GENERAL] Implementing "thick"/"fat" databases

2011-07-23 Thread Alban Hertroys
On 22 Jul 2011, at 21:15, Karl Nack wrote: > But this still falls short, since we're still basically managing the > transaction in the application layer. The problem you're facing here is that database statements work with records, while your example has a need to handle a set of (different type

Re: [GENERAL] Update columns in same table from update trigger?

2011-07-23 Thread Alban Hertroys
On 22 Jul 2011, at 22:02, Pablo Romero Abiti wrote: > The problem I'm facing is that the trigger before update won't execute if > there isn't a row with idcol=3 in the table warehouse. > > Here's my code: > > CREATE OR REPLACE FUNCTION update_warehouse() returns "trigger" AS ' >declare idco