Re: [HACKERS] How to make @id or $id as parameter name in plpgsql,isit available?

2004-11-25 Thread Arnold.Zhu
following is only program fragment, original program structure is from sample
named Duwamish in ms vs.net 2002.

/
private const String ID_PARM= "@id"; 
private const String NAME_PARM  = "@name"; 

public UserData GetUserById(int id)
{
if ( dataAdapter == null )
{
throw new System.ObjectDisposedException( GetType().FullName );
}

UserData userData = new UserData();

dataAdapter.SelectCommand = GetUserByIdCommand();
dataAdapter.SelectCommand.Parameters[ID_PARM].Value = id; 
dataAdapter.Fill(data); 

return userData;
}

private SelectCommand GetUserByIdCommand()
{
if ( getUserCommand == null) 
{ 
selectUserByIdCommand = new SelectCommand("user_select_by_id", 
Configuration.ConnectDB());
selectUserByIdCommand.CommandType = CommandType.StoredProcedure;

ParameterCollection params = selectUserByIdCommand.Parameters; 
params.Add(new Parameter(ID_PARM, DbType.Int32));
} 
return selectUserByIdCommand; 
}
/

-
CREATE TABLE users (
id serial NOT NULL,
name character varying(32) NOT NULL
);
-
CREATE TYPE user_set AS (
id integer,
name character varying(32)
);
-
CREATE FUNCTION user_select_by_id("@id" int4)
RETURNS SETOF user_set
AS '
declare rec record;

begin

for rec in
select * from users where id = "@id"
loop
return next rec;
end loop;
return;

end; '
LANGUAGE plpgsql;
-

Thanks & Regards!
 
Arnold.Zhu
2004-11-26




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] Beta5 now Available

2004-11-25 Thread Stephen Frost
* Marc G. Fournier ([EMAIL PROTECTED]) wrote:
> we're not talking load issues this time ... the way I understand it, 
> bittorrent has a 'tracker' process that only one can be running on the "BT 
> Distributed Network" at once ... so, if the bt "central server" goes down, 
> the whole bt network goes down with it ...
> 
> At least, this is my understanding, someone please correct me if I'm wrong 
> ...

I *think*, not 100% sure, but I believe you could have multiple
trackers, hosted by different systems, but the problem is that you'll
split your clients between them and they won't talk to each other even
though they potentially could.  Also, if one of the trackers went down
the clients using it would also go down (or at least, the stream from
that tracker would).

Stephen


signature.asc
Description: Digital signature


Re: [HACKERS] How to make @id or $id as parameter name in plpgsql,isit available?

2004-11-25 Thread Arnold.Zhu
Hello, Francisco Figueiredo Jr.

yes, I'd like to. Thank you for talking with you. ^_^

>H, could you  add a feature request in Npgsql project?
>
>This feature may be helpful for other users who are porting their apps
>to postgresql :)
>
>Also, if possible, please add a simple test case with the expected
>result so we can work on it.


Thanks & Regards!
 
Arnold.Zhu
2000-11-26




---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] Beta5 now Available

2004-11-25 Thread Gaetano Mendola
Thomas Hallgren wrote:
Gaetano Mendola wrote:
...so the very first client is the real server
that must be run 24/24.
I don't think this is correct. You need a tracker for downloaders to be 
able to find each other but no client is more important than the others.

I'm sorry to say that you're wrong. A tracker without a client running on
a complete file is completelly useless. The tracker even doesn't know
what you are "sharing".
If you want publish your files you have to start a tracker and a client
on each content to distribute. The client that you run on the complete
content will tell you: "Downloaded" and will stay there waiting for other
client connections.
Regards
Gaetano Mendola
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [HACKERS] Wishlist: subqueries that return multiple columns

2004-11-25 Thread Philippe Schmid
I've several times wanted a way to add multiple select output columns 
using a
single expression. A typical scenario would be if the columns come 
from a
subselect from another table where repeating the subselect means slow
performance as well as awkward and repetitive code.

Sometimes the subselect can be rewritten as a join, but that is not 
always the
case. Consider something like:

select customer.*,
   (select avg(amount),sum(amount) from purchases
 where purchases.customer_id = customer.customer_id
   ) as (avg_purchase, total_purchase),
   (select avg(amount),sum(amount) from quotes
 where quotes.customer_id = customer.customer_id
   ) as (avg_quote, total_quote)
  from customer
(Ok, actually that could be done as a join using some trickery with 
GROUP BY,
but I have other scenarios where it can't because the subselects 
overlap.)
Yes !! this would be very useful.
I am using such constructs a lot for crosstabs with different time 
periods for ex. (lots of subselects) and then doing some simple math 
with the resulting columns, ratios for ex.

With the new support for complex data types like arrays and structures 
perhaps
I could do this by constructing a RECORD in each subselect and then 
wrapping
another layer around the query where I explicitly list each element of 
the
RECORD that I want to include in the result set.

But it would be nice to have some more convenient mechanisms for 
handling this
case.

--
greg
Philippe Schmid
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[HACKERS] Wishlist: subqueries that return multiple columns

2004-11-25 Thread Greg Stark

I've several times wanted a way to add multiple select output columns using a
single expression. A typical scenario would be if the columns come from a
subselect from another table where repeating the subselect means slow
performance as well as awkward and repetitive code.

Sometimes the subselect can be rewritten as a join, but that is not always the
case. Consider something like:

select customer.*,
   (select avg(amount),sum(amount) from purchases 
 where purchases.customer_id = customer.customer_id
   ) as (avg_purchase, total_purchase),
   (select avg(amount),sum(amount) from quotes
 where quotes.customer_id = customer.customer_id
   ) as (avg_quote, total_quote)
  from customer

(Ok, actually that could be done as a join using some trickery with GROUP BY,
but I have other scenarios where it can't because the subselects overlap.)

With the new support for complex data types like arrays and structures perhaps
I could do this by constructing a RECORD in each subselect and then wrapping
another layer around the query where I explicitly list each element of the
RECORD that I want to include in the result set.

But it would be nice to have some more convenient mechanisms for handling this
case.

-- 
greg


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] Intermittent bug

2004-11-25 Thread Thomas Hallgren
Tom Lane wrote:
Well, you're not right ...
 

That's true. This time it was my own fault altogether I'm afraid.
Regards,
Thomas Hallgren

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] problem installing 8.0.0beta5 on OS X 10.3

2004-11-25 Thread Tom Lane
Will Arp <[EMAIL PROTECTED]> writes:
> please find attached the config.log

configure:2008: checking for C compiler default output
configure:2011: gccconftest.c  >&5
configure:2014: $? = 0
configure:2047: result: a.out
configure:2052: checking whether the C compiler works
configure:2058: ./a.out
./configure: line 1: ./a.out: No such file or directory
configure:2061: $? = 127
configure:2069: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

Wow, that's an interesting spelling of "a.out" ;-)

Apparently you've got "ls" hacked up in such a way that it puts some
highlighting escape sequences into its output even when it's invoked
by a script.  This is a bad idea, because it will break lots more
stuff than just configure scripts.

regards, tom lane

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] Explain output: wrong row count?

2004-11-25 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> I have this EXPLAIN ANALYZE output:
> ...
>->  Hash  (cost=13.99..13.99 rows=499 width=89) (actual time=5.947..5.947 
> rows=0 loops=1)
>  ->  Seq Scan on ciudad  (cost=0.00..13.99 rows=499 width=89) (actual 
> time=0.018..3.909 rows=499 loops=1)

> Note that the Hash step has an estimated row count of 499 (which is a
> good estimate), but the actual row count is 0, which is way off.

The "actual rows" count on a Hash node is always 0, because we don't
retrieve rows from it in the normal way (ie via ExecProcNode).  The
actual row count from the child plan node (here, the 499 for the
seqscan) tells you how many rows got loaded into the hashtable.

I've occasionally thought about putting in some kind of kluge to set the
"actual rows" count to the hash table size, just because it looks funny
to have zero there.  But it hasn't got to the top of the to-do list ...

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [HACKERS] Solaris 8 regression test failure with 8.0.0beta5

2004-11-25 Thread Greg Stark

Tom Lane <[EMAIL PROTECTED]> writes:

> This query would invoke the following code in int4div:
> 
> if (arg2 == 0)
> ereport(ERROR,
> (errcode(ERRCODE_DIVISION_BY_ZERO),
>  errmsg("division by zero")));
> 
> result = arg1 / arg2;
> 
> I suggest directing some strong words to your compiler vendor.  If the
> "if" test doesn't complete before the subsequent division causes a trap,
> that is not our problem.

I have a vague memory that IEEE floats have zero coming in two flavours, 0 and
-0. I wonder if it's possible merely comparing against 0 isn't covering all
the possible cases that can trigger a division by zero trap.

-- 
greg


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] Intermittent bug

2004-11-25 Thread Tom Lane
Thomas Hallgren <[EMAIL PROTECTED]> writes:
> It's my PL/Java test framework that fails so it's a bit complex but if 
> I'm right, any immutable, set-returning function that allocates stuff in 
> multi_call_memory_context at first call and then reused it, should show 
> the same problem.

Well, you're not right, because nearly every SRF we have does that.

My thought is that there is something specific to the query you are
using that is a contributing factor...

regards, tom lane

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] pg_dump for values inserted in last day

2004-11-25 Thread Robert Treat
On Monday 22 November 2004 14:33, vertigo wrote:
> Hello
> I need to "pg_dump" my database, but i want only to receive sql commands
> which will insert row which were inserted into database today. Is there
> any way to do it ?
> I have large database and i want to make "incremential backups".
>

Daily pg_dump -a -d diffed against the preceeding day should give you 
something close.  Watch out for schema changes though. 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] problem installing 8.0.0beta5 on OS X 10.3

2004-11-25 Thread Tom Lane
Will Arp <[EMAIL PROTECTED]> writes:
> checking whether the C compiler works... configure: error: cannot run C 
> compiled programs.

You need to fix the problem, not rip out the configure test that told
you there was a problem.

It would be useful to look at the portion of config.log that records
this test step.  My best guess is that there's something broken about
your gcc installation, but the exact cause is not knowable from just
the summary output.

regards, tom lane

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Intermittent bug

2004-11-25 Thread Thomas Hallgren
Tom Lane wrote:
What life span does the context->multi_call_memory_context have in case 
of IMMUTABLE functions that returns SETOF?
   

It should be long enough.  What's your test case exactly?
 

It's my PL/Java test framework that fails so it's a bit complex but if 
I'm right, any immutable, set-returning function that allocates stuff in 
multi_call_memory_context at first call and then reused it, should show 
the same problem.

I do have a way of logging MemoryContext termination by replacing the 
function pointer used for context delete with an interceptor that does 
elog(DEBUG1). I'll see if I can prove that it actually get's deleted 
between rows. If it does, perhaps I can find the time to write a sample.

Regards,
Thomas Hallgren

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] Intermittent bug

2004-11-25 Thread Tom Lane
Thomas Hallgren <[EMAIL PROTECTED]> writes:
> What life span does the context->multi_call_memory_context have in case 
> of IMMUTABLE functions that returns SETOF?

It should be long enough.  What's your test case exactly?

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[HACKERS] Explain output: wrong row count?

2004-11-25 Thread Alvaro Herrera
I have this EXPLAIN ANALYZE output:

alvherre=# explain analyze select * from oficina join ciudad using
(codciudad) where codtipoofi in (4,5);
QUERY PLAN  
  
--
 Hash Join  (cost=15.24..68.76 rows=621 width=394) (actual time=6.003..22.175 
rows=641 loops=1)
   Hash Cond: ("outer".codciudad = "inner".codciudad)
   ->  Seq Scan on oficina  (cost=0.00..42.66 rows=621 width=309) (actual 
time=0.013..3.103 rows=641 loops=1)
 Filter: ((codtipoofi = 4) OR (codtipoofi = 5))
   ->  Hash  (cost=13.99..13.99 rows=499 width=89) (actual time=5.947..5.947 
rows=0 loops=1)
 ->  Seq Scan on ciudad  (cost=0.00..13.99 rows=499 width=89) (actual 
time=0.018..3.909 rows=499 loops=1)
 Total runtime: 24.448 ms
(7 rows)

Note that the Hash step has an estimated row count of 499 (which is a
good estimate), but the actual row count is 0, which is way off.  But,
the outer Hash Join step has a good estimate.

I wonder if the rows=0 is a bug, or is that number meant to be
interpreted in some special way?  It is the same on both 7.4.6 and
8.0beta5.  (Now that I look, it's 0 in all Hash steps I have at sight
... I had never noticed before!)


This query doesn't actually affect me a lot, but it is part of a bigger
query whose estimation is way off.  I won't post it here because it's
topic for pgsql-performance ...

-- 
Alvaro Herrera (<[EMAIL PROTECTED]>)
"No reniegues de lo que alguna vez creĆ­ste"

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [HACKERS] Intermittent bug

2004-11-25 Thread Thomas Hallgren
After some pretty tedious assembly debugging I've managed to locate the 
source of my problem. It is probably similar to a bug involving 
MemoryContext life cycle on IMMUTABLE functions that I struggled with 
last winter (later fixed by Tom).

This is what happens:
I have an function declared as IMMUTABLE that returns a SETOF tuples. I 
palloc some data using the context->multi_call_memory_context during the 
SRF_IS_FIRSTCALL phase and I assign that data to the context->user_fctx.

I obtain the context again using SRF_PERCALL_SETUP() and from that my 
palloc'ed data. I have verified that I get the exact same pointer. I do, 
but the memory that it points to is no longer accessible! I get an 
access fault and I can't even display that memory in the debugger. This 
tells me that the memory is no longer bound to the process, it must have 
been free'd up.

What life span does the context->multi_call_memory_context have in case 
of IMMUTABLE functions that returns SETOF?

Regards,
Thomas Hallgren

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [HACKERS] problem installing 8.0.0beta5 on OS X 10.3

2004-11-25 Thread Adam Witney

You shouldn't need to edit configure. I compiled 8.0b5 on 10.3.6 with no
problems yesterday

I am no expert, but this error seems to have come up on other platforms...
Here was the response in the mailing lists before

http://archives.postgresql.org/pgsql-ports/2004-07/msg1.php

You may also want to report back to the list what your gcc version is?


Also, if you installed readline with fink you may need to configure like so:

./configure --with-libs=/sw/lib --with-includes=/sw/include

(if your fink is installing in /sw of course)

HTH

Adam


> I'm trying to compile beta5 on osx 10.3.6
> without success, I have XCode 1.5 installed.
> 
> Could you please give me instructions?
> I have readline installed from fink.
> Bison is there from Apple.
> 
> This is from the Terminal.app:
> ~/Desktop/postgresql-8.0.0beta5 (alpha) ./configure
> --bindir=/usr/local/bin --mandir=/usr/local/share/man/ --enable-recode
> --enable-syslog --enable-unicode-conversion --enable-multibyte
> --with-includes=/sw/include/ --with-libraries=/sw/lib
> checking build system type... powerpc-apple-darwin7.6.0
> checking host system type... powerpc-apple-darwin7.6.0
> checking which template to use... darwin
> checking whether to build with 64-bit integer date/time support... no
> checking whether NLS is wanted... no
> checking for default port number... 5432
> checking for gcc... gcc
> checking for C compiler default output... a.out
> checking whether the C compiler works... configure: error: cannot run C
> compiled programs.
> If you meant to cross compile, use `--host'.
> 
> After removing line 2050 to 2077 in configure:
> 
> #
> # Check the compiler produces executables we can run.  If not, either
> # the compiler is broken, or we cross compile.
> echo "$as_me:$LINENO: checking whether the C compiler works" >&5
> echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
> # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
> # If not cross compiling, check that we can run a simple program.
> if test "$cross_compiling" != yes; then
>  if { ac_try='./$ac_file'
>  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
>  (eval $ac_try) 2>&5
>  ac_status=$?
>  echo "$as_me:$LINENO: \$? = $ac_status" >&5
>  (exit $ac_status); }; }; then
>cross_compiling=no
>  else
>if test "$cross_compiling" = maybe; then
> cross_compiling=yes
>else
> { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
> If you meant to cross compile, use \`--host'." >&5
> echo "$as_me: error: cannot run C compiled programs.
> If you meant to cross compile, use \`--host'." >&2;}
>   { (exit 1); exit 1; }; }
>fi
>  fi
> fi
> echo "$as_me:$LINENO: result: yes" >&5
> echo "${ECHO_T}yes" >&6
> #
> 
> I was able to configure, at least I got:
> All of PostgreSQL successfully made. Ready to install.
> 
> but then:
> ~/Desktop/postgresql-8.0.0beta5 (user) sudo make install
> make -C doc install
> for file in man1/*.1 man7/*.7 ; do \
>  /bin/sh ../config/install-sh -c -m 644 $file
> /usr/local/share/man//$file || exit; \
> done
> make -C src install
> /bin/sh ../config/mkinstalldirs /usr/local/pgsql/lib/pgxs/src
> mkdir -p -- /usr/local/pgsql/lib/pgxs/src
> /bin/sh ../config/install-sh -c -m 644 Makefile.global
> /usr/local/pgsql/lib/pgxs/src/Makefile.global
> /bin/sh ../config/install-sh -c -m 644 Makefile.port
> /usr/local/pgsql/lib/pgxs/src/Makefile.port
> /bin/sh ../config/install-sh -c -m 644 ./Makefile.shlib
> /usr/local/pgsql/lib/pgxs/src/Makefile.shlib
> /bin/sh ../config/install-sh -c -m 644 ./nls-global.mk
> /usr/local/pgsql/lib/pgxs/src/nls-global.mk
> make -C port install
> /bin/sh ../../config/install-sh -c -m 644  libpgport.a
> /usr/local/pgsql/lib
> make -C timezone install
> make -C ../../src/port all
> make[3]: Nothing to be done for `all'.
> gcc -no-cpp-precomp -O4 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wendif-labels -fno-strict-aliasing zic.o ialloc.o scheck.o localtime.o
> -L../../src/port -L/sw/lib/  -lpgport -lz -lreadline -lresolv -ldl -lm
> -o zic.out
> mkdir -p -- /usr/local/pgsql/share
> ./zic -d /usr/local/pgsql/share/timezone ./data/africa
> ./data/antarctica ./data/asia ./data/australasia ./data/europe
> ./data/northamerica ./data/southamerica ./data/pacificnew
> ./data/etcetera ./data/factory ./data/backward ./data/systemv
> ./data/solar87 ./data/solar88 ./data/solar89
> make[2]: ./zic: Command not found
> make[2]: *** [install] Error 127
> make[1]: *** [install] Error 2
> make: *** [install] Error 2
> 
> 
> 
> I did remove XCode 1.5, installed XCode 1.2, no difference. 8(
> 
> Well If you have an idea, I'd welcome it 8)
> 
> Have a nice day!
> 
> Will
> 
> 
> ---(end of broadcast)---
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match


-- 
This message has been scanned for viruses and
dangerous content by MailScanne

Re: [HACKERS] Beta5 now Available

2004-11-25 Thread Alvaro Herrera
On Wed, Nov 24, 2004 at 11:28:31AM -0600, Gavin M. Roy wrote:
> To a degree you are correct.  AFAIK new downloads could not start if the 
> tracker crashed. The tracker is the traffic cop that tells peer nodes 
> about each other.  I dont believe the tracker that comes from the main 
> bit torrent author allows for multiple trackers with a common data 
> repository, but if we're really interested, maybe we could hack up the 
> code to talk to a central pgsql database allowing multiple trackers on a 
> dns rr.

I think I've seen some torrents with a "multi-host" definition of
tracker.  Not sure how that works, or how clients react to it.  But
before you hack that up, make sure to check for previous attempts,
mainly for client compatibility.

-- 
Alvaro Herrera (<[EMAIL PROTECTED]>)
"Tiene valor aquel que admite que es un cobarde" (Fernandel)

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[HACKERS] problem installing 8.0.0beta5 on OS X 10.3

2004-11-25 Thread Will Arp
I'm trying to compile beta5 on osx 10.3.6
without success, I have XCode 1.5 installed.
Could you please give me instructions?
I have readline installed from fink.
Bison is there from Apple.
This is from the Terminal.app:
~/Desktop/postgresql-8.0.0beta5 (alpha) ./configure 
--bindir=/usr/local/bin --mandir=/usr/local/share/man/ --enable-recode 
--enable-syslog --enable-unicode-conversion --enable-multibyte 
--with-includes=/sw/include/ --with-libraries=/sw/lib
checking build system type... powerpc-apple-darwin7.6.0
checking host system type... powerpc-apple-darwin7.6.0
checking which template to use... darwin
checking whether to build with 64-bit integer date/time support... no
checking whether NLS is wanted... no
checking for default port number... 5432
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... configure: error: cannot run C 
compiled programs.
If you meant to cross compile, use `--host'.

After removing line 2050 to 2077 in configure:
#
# Check the compiler produces executables we can run.  If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
  if { ac_try='./$ac_file'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
cross_compiling=no
  else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'." >&5
echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'." >&2;}
   { (exit 1); exit 1; }; }
fi
  fi
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
#
I was able to configure, at least I got:
All of PostgreSQL successfully made. Ready to install.
but then:
~/Desktop/postgresql-8.0.0beta5 (user) sudo make install
make -C doc install
for file in man1/*.1 man7/*.7 ; do \
  /bin/sh ../config/install-sh -c -m 644 $file 
/usr/local/share/man//$file || exit; \
done
make -C src install
/bin/sh ../config/mkinstalldirs /usr/local/pgsql/lib/pgxs/src
mkdir -p -- /usr/local/pgsql/lib/pgxs/src
/bin/sh ../config/install-sh -c -m 644 Makefile.global 
/usr/local/pgsql/lib/pgxs/src/Makefile.global
/bin/sh ../config/install-sh -c -m 644 Makefile.port 
/usr/local/pgsql/lib/pgxs/src/Makefile.port
/bin/sh ../config/install-sh -c -m 644 ./Makefile.shlib 
/usr/local/pgsql/lib/pgxs/src/Makefile.shlib
/bin/sh ../config/install-sh -c -m 644 ./nls-global.mk 
/usr/local/pgsql/lib/pgxs/src/nls-global.mk
make -C port install
/bin/sh ../../config/install-sh -c -m 644  libpgport.a 
/usr/local/pgsql/lib
make -C timezone install
make -C ../../src/port all
make[3]: Nothing to be done for `all'.
gcc -no-cpp-precomp -O4 -Wall -Wmissing-prototypes -Wpointer-arith 
-Wendif-labels -fno-strict-aliasing zic.o ialloc.o scheck.o localtime.o 
-L../../src/port -L/sw/lib/  -lpgport -lz -lreadline -lresolv -ldl -lm  
-o zic.out
mkdir -p -- /usr/local/pgsql/share
./zic -d /usr/local/pgsql/share/timezone ./data/africa 
./data/antarctica ./data/asia ./data/australasia ./data/europe 
./data/northamerica ./data/southamerica ./data/pacificnew 
./data/etcetera ./data/factory ./data/backward ./data/systemv 
./data/solar87 ./data/solar88 ./data/solar89
make[2]: ./zic: Command not found
make[2]: *** [install] Error 127
make[1]: *** [install] Error 2
make: *** [install] Error 2


I did remove XCode 1.5, installed XCode 1.2, no difference. 8(
Well If you have an idea, I'd welcome it 8)
Have a nice day!
Will
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


Re: [HACKERS] lwlocks and starvation

2004-11-25 Thread Simon Riggs
On Thu, 2004-11-25 at 11:28, Neil Conway wrote:
> Simon Riggs wrote:
> > I'd been thinking about lock release order also, thinking that this
> > could be related to the CS storms observed earlier and the apparent
> > lock-step behaviour commented upon previously.
> 
> As much as I would love to believe this (because it would mean we could 
> probably solve the problem pretty easily), I don't think lock release 
> order is the (primary) culprit behind the CS storm issue. 

Wish we had a way to tell... though I think you are right.

> As I 
> understand it, the heavily contended lock in those situations is the 
> BufMgrLock, and that is _always_ acquired in exclusive mode.

So you're saying this doesn't effect BufMgrLock contention? Oh.

> > ISTM that waking
> > shared waiters in xid order would bring the most benefit and minimise
> > any data issues. Readers waiting behind an exclusive waiter, where the
> > reader has a lower xid might reasonably be woken without a problem since
> > they will never see the changes made by the exclusive waiter anyway.
> 
> I'm not sure I understand. What "data issues" are you referring to? 
> LWLocks are used to protect non-transactional resources (such as shared 
> memory data structures), so the relative xids of two waiter processes 
> doesn't affect whether they can see each other's modifications (i.e. 
> because they always can).

Yes, understand the difference. But when we check for tuple visibility,
the changes would be ignored, hence it is OK to resort the list from
FIFO to xid order, but...

> In any case, the idea of considering information such as the xid when 
> deciding which waiters to release is interesting. It's not immediately 
> apparent to me quite *how* to make use of that info, but it's definitely 
> something to consider...

Agreed. 

It's a wacky idea and I'm not embarrassed having them. The day I stop
having them will be the day I stop having good ideas too. But please
don't let this distract from your own good-idea:

Well done to you, Neil.

-- 
Best Regards, Simon Riggs


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] lwlocks and starvation

2004-11-25 Thread Neil Conway
Simon Riggs wrote:
I'd been thinking about lock release order also, thinking that this
could be related to the CS storms observed earlier and the apparent
lock-step behaviour commented upon previously.
As much as I would love to believe this (because it would mean we could 
probably solve the problem pretty easily), I don't think lock release 
order is the (primary) culprit behind the CS storm issue. As I 
understand it, the heavily contended lock in those situations is the 
BufMgrLock, and that is _always_ acquired in exclusive mode.

ISTM that waking
shared waiters in xid order would bring the most benefit and minimise
any data issues. Readers waiting behind an exclusive waiter, where the
reader has a lower xid might reasonably be woken without a problem since
they will never see the changes made by the exclusive waiter anyway.
I'm not sure I understand. What "data issues" are you referring to? 
LWLocks are used to protect non-transactional resources (such as shared 
memory data structures), so the relative xids of two waiter processes 
doesn't affect whether they can see each other's modifications (i.e. 
because they always can).

In any case, the idea of considering information such as the xid when 
deciding which waiters to release is interesting. It's not immediately 
apparent to me quite *how* to make use of that info, but it's definitely 
something to consider...

-Neil
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [HACKERS] plpgsql lacks generic identifier for record in triggers...

2004-11-25 Thread Weiping

db=# CREATE FUNCTION schma.tbl_ins_upd() RETURNS TRIGGER AS 'BEGIN
EXECUTE public.mc_init();
EXECUTE public.mc_delete(''mc_key'');
RETURN NEW;
END;' LANGUAGE 'plpgsql';
db=# CREATE FUNCTION schma.tbl_del() RETURNS TRIGGER AS 'BEGIN
EXECUTE public.mc_init();
EXECUTE public.mc_delete(''mc_key'');
RETURN OLD;
END;' LANGUAGE 'plpgsql';
could this be used?
CREATE FUNCTION schma.tbl_ins_upd() RETURNS TRIGGER AS 'BEGIN
   EXECUTE public.mc_init();
   EXECUTE public.mc_delete(''mc_key'');
   if TG_OP = ''INSERT'' or TG_OP = ''UPDATE'' then
   RETURN NEW;
   else
   RETURN OLD;
   end if;   
END;' LANGUAGE 'plpgsql';

regards
Laser
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [HACKERS] Help!

2004-11-25 Thread Richard Huxton
ElayaRaja S wrote:
Hi,
While configuring OpenCRX by using Postgresql i am facing probmelm.
The problem while creating db using the command ( createdb -h
localhost -E utf8 -U system crx-CRX ) .
Erro:
createdb: could not connect to database template1: could not connect
to server:
 Connection refused
  Is the server running on host "localhost" and accepting
  TCP/IP connections on port 5432?
This isn't really the right list - I'll repost onto the General list for 
you now. Please join me there, and don't reply to this message.

--
  Richard Huxton
  Archonet Ltd
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [HACKERS] lwlocks and starvation

2004-11-25 Thread Simon Riggs
On Wed, 2004-11-24 at 12:52, Neil Conway wrote:
> Bruce Momjian wrote:
> > I thought the new readers will sit after the writer in the FIFO queue so
> > the writer will not starve.
> 
> AFAICS, that is not the case. See lwlock.c, circa line 264: in LW_SHARED 
> mode, we check if "exclusive" is zero; if so, we acquire the lock 
> (increment the shared lock count and do not block). And "exclusive" is 
> set non-zero only when we _acquire_ a lock in exclusive mode, not when 
> we add an exclusive waiter to the wait queue.

Wow...well spotted.

That could explain many recent performance results. 

On Wed, 2004-11-24 at 08:23, Neil Conway wrote: 
> LWLockRelease() currently does something like (simplifying a lot):
> 
> acquire lwlock spinlock
> decrement lock count
> if lock is free
>   if first waiter in queue is waiting for exclusive lock,
>   awaken him; else, walk through the queue and awaken
>   all the shared waiters until we reach an exclusive waiter
> end if
> release lwlock spinlock
> 
> This has the nice property that locks are granted in FIFO order. Is it
> essential that we maintain that property? If not, we could instead walk
> through the wait queue and awaken *all* the shared waiters, and get a
> small improvement in throughput.

I'd been thinking about lock release order also, thinking that this
could be related to the CS storms observed earlier and the apparent
lock-step behaviour commented upon previously. FIFO is the most easily
theoretically predictable, but others are possible. ISTM that waking
shared waiters in xid order would bring the most benefit and minimise
any data issues. Readers waiting behind an exclusive waiter, where the
reader has a lower xid might reasonably be woken without a problem since
they will never see the changes made by the exclusive waiter anyway.
That probably needs to be within a limited window of inspection beyond
the exclusive waiter to limit the complexity, say 4-8 places beyond the
exclusive waiter.

Exactly what we do from here is going to dramatically effect performance
in various situations, so I think trying a few different algorithms
should help the understanding.

IMHO a concern remains that oprofile is not good enough instrumentation
to spot this kind of issue. Instrumentation at the lwlock level *would*
have spotted this and other issues too, and will also help us determine
what the differences are between the various ways forward for (possibly)
changing the current behaviour.

-- 
Best Regards, Simon Riggs


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html