Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-13 Thread 高健
Hi : Sorry for replying lately. I tried to take the commit statement out of the function , and it works well. Thank you! 2013/6/10 Kevin Grittner > 高健 wrote: > > > CREATE OR REPLACE Function ... > > > BEGIN > > BEGIN > > > UPDATE ... > > COMMIT; > > > EXCEPTION > > WHEN OTHERS TH

[GENERAL] Why hash join cost calculation need reduction

2013-06-13 Thread 高健
Hi : Sorry for disturbing. I don't know if it is ok to put this question here. I want to learn more about hash join's cost calculation. And I found the following function of PostgreSQL9.2.1. The hash join cost is calculated. But what confused me is a reuction calculation: qp_qual_cos

Re: [GENERAL] Determining the type (array, object, or scalar) of a JSON value

2013-06-13 Thread Andrew Tipton
On Wed, Jun 12, 2013 at 11:38 PM, Merlin Moncure wrote: > no argument against json_typeof, but why can you just peek the first > non-whitespace character? json is famously easy to parse (see here: > http://www.json.org/) > > create or replace function json_typeof(_json json) returns text as > $

Re: [GENERAL] Why hash join cost calculation need reduction

2013-06-13 Thread Stephen Frost
Greetings, * 高健 (luckyjack...@gmail.com) wrote: > And I found the following function of PostgreSQL9.2.1. The hash join cost > is calculated. > > But what confused me is a reuction calculation: > > qp_qual_cost.per_tuple -= hash_qual_cost.per_tuple; > > My question is: > > Why the reduction i

Re: [GENERAL] Get data type aliases

2013-06-13 Thread Rebecca Clarke
That's great, thank you! worked like a charm. On Wed, Jun 12, 2013 at 8:31 PM, Alvaro Herrera wrote: > Rebecca Clarke escribió: > > Hi all. > > > > I have a function that has an attribute with datatype of character > varying. > > In the pg_type table the oid of the data type points to type varch

Re: [GENERAL] Why hash join cost calculation need reduction

2013-06-13 Thread Tom Lane
Stephen Frost writes: > * 高健 (luckyjack...@gmail.com) wrote: >> Why the reduction is needed here for cost calculation? > cost_qual_eval(&hash_qual_cost, hashclauses, root); > returns the costs for *just the quals which can be used for the > hashjoin*, while > cost_qual_eval(&qp_

Re: [GENERAL] Explicit LOAD and dynamic library loading

2013-06-13 Thread Tom Lane
Stephen Scheck writes: > [postgres@dev1 lib]$ ldd bar.so > linux-vdso.so.1 => (0x7fff1c7ff000) > libc.so.6 => /lib64/libc.so.6 (0x7fa4c96ac000) > /lib64/ld-linux-x86-64.so.2 (0x7fa4c9c5d000) So you're missing any reference to foo.so; not surprising it fails. Y

Re: [GENERAL] Explicit LOAD and dynamic library loading

2013-06-13 Thread Stephen Scheck
I modified the Makefile a bit and it all works now: MODULES = foo MODULE_big = bar OBJS = bar.o foo.so EXTENSION = foo bar One thing that's still a bit confusing, though ... I build the extensions in my own home dir, which results in the rpath getting set like this: -Wl,-rpath,'/vol/data/home/ssc

Re: [GENERAL] Explicit LOAD and dynamic library loading

2013-06-13 Thread Tom Lane
Stephen Scheck writes: > One thing that's still a bit confusing, though ... I build the extensions > in my own home dir, which results in the rpath getting set like > this: -Wl,-rpath,'/vol/data/home/sscheck/sandbox/postgresql-9.2.4-build/lib' Hm, it should be .../lib under whatever you configure

Re: [GENERAL] Why hash join cost calculation need reduction

2013-06-13 Thread 高健
Hello: Thanks for replying! I understand it a little more. And I compared the following statements: First: postgres=# explain analyze select * from sales s inner join customers c on s.cust_id = c.cust_id; QUERY PLAN -