Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Magnus Hagander
  I'm writing up the new GUCs, and noticed that max_prepared_transactions 
  defaults to 5.  This is too many for most applications (which don't use 
  them 
  at all) and far too few for applications which use them regularly.  
 
 I think the intention was to have enough so you could test 'em (in
 particular, run the regression tests) without eating resources for
 the majority of installations that aren't using them.
 
 Certainly an installation that *is* using 'em would want a higher
 setting.

Can' we make the default 0, which is what the majority should want, and have 
the regression test explicitly set it up on the commandline?

/Magnus


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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] Why copy_relation_data only use wal when WALarchiving is enabled

2007-10-18 Thread Jacky Leng
 You need to set $PGDATA before running the script. And psql,pg_ctl and
 pg_resetxlog need to be in $PATH. After running the script, restart
 postmaster and run SELECT * FROM t2. There should be one row in the
 table, but it's empty.

I've tried this script, and superisingly  found that T2 is not empty, just 
as it should be.
Then I see how cluster is done, and found that



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


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Jacky Leng

 Heikki Linnakangas [EMAIL PROTECTED] writes:
 I tend to agree that truncating the file, and extending the fsync
 request mechanism to actually delete it after the next checkpoint,
 is the most reasonable route to a fix.


How about just allowing to use wal even WAL archiving is disabled?
It seems that recovery of XLOG_HEAP_NEWPAGE record will do the
right thing for us, look at heap_xlog_newpage: XLogReadBuffer
with init=true will extend the block rightly and rebuild it rightly.

Someone may say that it's not worth recording xlog for operations
such as copy_relation_data, but these operations shouldn't happen
frequently. 



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


Re: [HACKERS] Why copy_relation_data only use wal when WALarchiving is enabled

2007-10-18 Thread Jacky Leng
Sorry, send the mail wrongly just now.

 You need to set $PGDATA before running the script. And psql,pg_ctl and
 pg_resetxlog need to be in $PATH. After running the script, restart
 postmaster and run SELECT * FROM t2. There should be one row in the
 table, but it's empty.

I've tried this script on postgres (PostgreSQL) 8.3devel, and found that
T2 is not empty after recovery(just as it should be)---but the latest 
version
act just like what you said.

Then I see how cluster is done, and found that:
In postgres (PostgreSQL) 8.3devel, unlike AlterTableSetTablespace (which
copys the whole relation block-by-block, and doesn't use wal under 
non-archiving
mode), Cluster copys the relation row-by-row(simple_heap_insert), which
always uses wal regardless of archiving mode. As wal exists, recovery will
cope with everything rightly.
The latest version acts differently probably because that it removes wal of 
cluser
under non-archiving mode.

So the conclusion is: we can replace wal mechanism with smgrimmedsync only 
if
relfilenode is not allowed to be reused, but this's not true, so what we 
should
keep wal.

Is it right? 



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


Re: [HACKERS] Why copy_relation_data only use wal when WALarchiving is enabled

2007-10-18 Thread Jacky Leng
 You need to set $PGDATA before running the script. And psql,pg_ctl and
 pg_resetxlog need to be in $PATH. After running the script, restart
 postmaster and run SELECT * FROM t2. There should be one row in the
 table, but it's empty.

I've tried this script on postgres (PostgreSQL) 8.3devel, and found that
T2 is not empty after recovery(just as it should be)---but the latest 
version
act just like what you said.

Then I see how cluster is done, and found that:
In postgres (PostgreSQL) 8.3devel, unlike AlterTableSetTablespace (which
copys the whole relation block-by-block, and doesn't use wal under 
non-archiving
mode), Cluster copys the relation row-by-row(simple_heap_insert), which
always uses wal regardless of archiving mode. As wal exists, recovery will
cope with everything rightly.
The latest version acts differently probably because that it removes wal of 
cluser
under non-archiving mode.

So the conclusion is: we can replace wal mechanism with smgrimmedsync only 
if
relfilenode is not allowed to be reused, but this's not true, so what we 
should
keep wal.

Is it right? 



---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Why copy_relation_data only use wal when WALarchiving is enabled

2007-10-18 Thread Jacky Leng
 You need to set $PGDATA before running the script. And psql,pg_ctl and
 pg_resetxlog need to be in $PATH. After running the script, restart
 postmaster and run SELECT * FROM t2. There should be one row in the
 table, but it's empty.

I've tried this script on postgres (PostgreSQL) 8.3devel, and found that
T2 is not empty after recovery(just as it should be)---but the latest 
version
act just like what you said.

Then I see how cluster is done, and found that:
In postgres (PostgreSQL) 8.3devel, unlike AlterTableSetTablespace (which
copys the whole relation block-by-block, and doesn't use wal under 
non-archiving
mode), Cluster copys the relation row-by-row(simple_heap_insert), which
always uses wal regardless of archiving mode. As wal exists, recovery will
cope with everything rightly.
The latest version acts differently probably because that it removes wal of 
cluser
under non-archiving mode.

So the conclusion is: we can replace wal mechanism with smgrimmedsync only 
if
relfilenode is not allowed to be reused, but this's not true, so what we 
should
keep wal.

Is it right? 



---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Heikki Linnakangas
Jacky Leng wrote:
 I tend to agree that truncating the file, and extending the fsync
 request mechanism to actually delete it after the next checkpoint,
 is the most reasonable route to a fix.
 
 How about just allowing to use wal even WAL archiving is disabled?
 It seems that recovery of XLOG_HEAP_NEWPAGE record will do the
 right thing for us, look at heap_xlog_newpage: XLogReadBuffer
 with init=true will extend the block rightly and rebuild it rightly.
 
 Someone may say that it's not worth recording xlog for operations
 such as copy_relation_data, but these operations shouldn't happen
 frequently. 

Always using WAL would fix the problem, but it's a big performance hit.
WAL-logging doubles the amount of write I/O required.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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


Re: [HACKERS] ts_rewrite aggregate API seems mighty ugly

2007-10-18 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes:

 Since we're already committed to an initdb for beta2, it's not quite too
 late to reconsider the API here.  My feeling at the moment is that we
 should just drop the aggregate form of ts_rewrite; it does nothing you
 can't do better with the two-argument form, and it is just ugly to boot.
 Also, if anyone does come up with a not-so-ugly design later, we can
 always add things in 8.4 or beyond; but once it's in core it's going
 to be a very hard sell to take it out.

The two-argument form may not be actively broken but it sounds not very
integrated. Passing a string which is then planned as an SQL query is not very
SQL-ish. If you prepare the query does that string get prepared? When do you
get syntax errors? If the plan's invalidated does it handle it correctly?

It sounds to me like once we have a good aggregate interface there's not much
point to the two-argument form. A good aggregate form would let you do the
subquery or a join or any other form of query to fetch all the replacements
you want.

I would suggest putting both the two-argument form and the aggregate form into
a contrib module -- effectively *back* into a contrib module until the
interfaces can be fully integrated into SQL. So whereas previously you
installed a contrib module for the whole tsearch2, now it's all integrated
except for a few oddball functions which you can still get by supplementing
the core tsearch with the contrib module.

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com

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

   http://archives.postgresql.org


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Heikki Linnakangas
Heikki Linnakangas wrote:
 Tom Lane wrote:
 I tend to agree that truncating the file, and extending the fsync
 request mechanism to actually delete it after the next checkpoint,
 is the most reasonable route to a fix.
 
 Ok, I'll write a patch to do that.

There's a small problem with that: DROP TABLESPACE checks that the
tablespace directory is empty, and fails if it sees one of those empty
files. You also run into that problem if you

1. BEGIN; CREATE TABLE; -- no commit
2. crash+restart
3. DROP TABLESPACE

because we leave behind the stale file created by CREATE TABLE.

The best I can think of is to rename the obsolete file to
relfilenode.stale, when it's scheduled for deletion at next
checkpoint, and check for .stale-suffixed files in GetNewRelFileNode,
and delete them immediately in DropTableSpace.

That still won't fix the problem with files created by a crashed
transaction. For that we had a plan a long time ago: after recovery,
scan the data directory for any files don't have a live row in pg_class,
and write a message to log for each so that the DBA can delete them
(deleting them automatically was considered too dangerous). That's
probably 8.4 material, though.

Thoughts?

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Merlin Moncure
On 10/18/07, Pavel Stehule [EMAIL PROTECTED] wrote:
 this function can help with array's iteration.

 create function generate_iterator(anyarray)
 returns setof integer
 as $$
 select i
   from generate_series(array_lower($1,1),
array_upper($1,1)) g(i)
 $$ language sql;

There was a very similar proposal a little while back (google:
array_to_set).  I think I like those names better since you are
returning a set, not an iterator :-).  Also, this should be internal
as you suggest (there is an undocumented builtin that already does
this, _pg_expandarray).

merlin

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Pavel Stehule
2007/10/18, Merlin Moncure [EMAIL PROTECTED]:
 On 10/18/07, Pavel Stehule [EMAIL PROTECTED] wrote:
  this function can help with array's iteration.
 
  create function generate_iterator(anyarray)
  returns setof integer
  as $$
  select i
from generate_series(array_lower($1,1),
 array_upper($1,1)) g(i)
  $$ language sql;

 There was a very similar proposal a little while back (google:
 array_to_set).  I think I like those names better since you are
 returning a set, not an iterator :-).  Also, this should be internal
 as you suggest (there is an undocumented builtin that already does
 this, _pg_expandarray).

I remember. There is only one important difference. What is behave of
array_to_set with multidim. array? the name generate_iterator is my
first idea (it retunrs set but setof indexes). I am sure so there are
better names :)
Pavel

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


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Pavel Stehule
2007/10/18, Merlin Moncure [EMAIL PROTECTED]:
 On 10/18/07, Pavel Stehule [EMAIL PROTECTED] wrote:
  this function can help with array's iteration.
 
  create function generate_iterator(anyarray)
  returns setof integer
  as $$
  select i
from generate_series(array_lower($1,1),
 array_upper($1,1)) g(i)
  $$ language sql;

 There was a very similar proposal a little while back (google:
 array_to_set).  I think I like those names better since you are
 returning a set, not an iterator :-).  Also, this should be internal
 as you suggest (there is an undocumented builtin that already does
 this, _pg_expandarray).

 merlin

one sample:
create or replace function array_unpack2(anyarray)
returns setof anyelement as $$
  select $1[i][j]
 from generate_iterator($1,1) i,
  generate_iterator($1,2) j$$
language sql;

postgres=# select array_unpack2(ARRAY[[10,11,12],[13,14,15]]);
 array_unpack2
---
10
11
12
13
14
15
(6 rows)

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Stephen Frost
* Magnus Hagander ([EMAIL PROTECTED]) wrote:
  Certainly an installation that *is* using 'em would want a higher
  setting.
 
 Can' we make the default 0, which is what the majority should want,
 and have the regression test explicitly set it up on the commandline?

I'm with Magnus on this one.  Having it set to just enough to test
with is just plain terrible.  A value of '5' seems high enough that it
might be fine while on a development system and maybe for a short time
on a production system which means it might not get noticed early enough
to get picked up on and fixed by an admin before a user notices.

I also like the on/off option, with the default being 'off' (where that
really means *off*, not on, but with a small number- that would be
even worse than the current situation).

Thanks,

Stephen


signature.asc
Description: Digital signature


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes:
 Can' we make the default 0, which is what the majority should want, and have 
 the regression test explicitly set it up on the commandline?

No.  It's a postmaster-start-time-only option, which means that your
proposal breaks make installcheck.

regards, tom lane

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


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Magnus Hagander
  Can' we make the default 0, which is what the majority should want, and 
  have the regression test explicitly set it up on the commandline?
 
 No.  It's a postmaster-start-time-only option, which means that your
 proposal breaks make installcheck.

Bummer. There are lots of ways to break installcheck though - locale being one 
I get biten by all the time... But I guess this one would break the default on 
US systems...

/Magnus

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


Re: [HACKERS] ts_rewrite aggregate API seems mighty ugly

2007-10-18 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes:
 The two-argument form may not be actively broken but it sounds not very
 integrated. Passing a string which is then planned as an SQL query is not very
 SQL-ish.

True.  I'll bet you don't like ts_stat() either.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[HACKERS] upgrade from 8.0.3 to 8.1.10 crash

2007-10-18 Thread Boergesson, Cheryl
Hello.  I am trying to upgrade from PostgreSQL 8.0.3 to PostgreSQL
8.1.10.  I'm on WindowsXP and I'm compiling with Visual C++ 6.0.

 

I have a very simple routine that works fine with the 8.0.3 version:

 

int easy_connect()

{

exec sql connect to my_db as my_cnxtn;

printf (connection results:\n);

printf (code: %d\n, sqlca.sqlcode);

printf (state: %s\n, sqlca.sqlstate);

printf (warn: %s\n, sqlca.sqlwarn);

exec sql begin work;

exec sql commit work;

return 0;

}

 

When I use the 8.1.10 version, the connection works ( sqlca.sqlcode is
0, sqlca.sqlstate is  and sqlca.sqlwarn is blank).  But it then
crashes on the exec sql begin work line.

 

I get the following error in a window:

 

Runtime Error!

 

Program: C:\testSQL.exe

 

This application has requested the Runtime to terminate it in an unusual
way.

Please contact the application's support team for more information.

 

I removed the 8.0.3 version using remove program from the control
panel.  I then went and removed my C:\Program Files\PostgreSQL\8.0
folder, just to make sure I was not including the wrong header files,
linking to the wrong libraries, or calling the wrong version of
ecpg.exe.

 

Thanks for any help.

-Cheryl

 



Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Tom Lane
Heikki Linnakangas [EMAIL PROTECTED] writes:
 The best I can think of is to rename the obsolete file to
 relfilenode.stale, when it's scheduled for deletion at next
 checkpoint, and check for .stale-suffixed files in GetNewRelFileNode,
 and delete them immediately in DropTableSpace.

This is getting too Rube Goldbergian for my tastes.  What if we just
make DROP TABLESPACE force a checkpoint before proceeding?

regards, tom lane

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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes:
 There was a very similar proposal a little while back (google:
 array_to_set).  I think I like those names better since you are
 returning a set, not an iterator :-).

I agree, this is a very poor choice of name.  There should be some
reference to arrays in it, for one thing.

generate_array_subscripts() maybe?

regards, tom lane

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


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Pavel Stehule
2007/10/18, Tom Lane [EMAIL PROTECTED]:
 Merlin Moncure [EMAIL PROTECTED] writes:
  There was a very similar proposal a little while back (google:
  array_to_set).  I think I like those names better since you are
  returning a set, not an iterator :-).

 I agree, this is a very poor choice of name.  There should be some
 reference to arrays in it, for one thing.

 generate_array_subscripts() maybe?

why not?

Pavel

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


[HACKERS] dblink un-named connection doesn't get re-used

2007-10-18 Thread Decibel!

Is it intentional that dblink's unnamed connections don't get re-used?

stats=# select datname, usename from pg_stat_activity;
datname | usename
-+-
stats   | decibel
(1 row)

stats=# select dblink_connect('dbname=stats');
dblink_connect

OK
(1 row)

stats=# select dblink_connect('dbname=postgres');
dblink_connect

OK
(1 row)

stats=# select datname, usename from pg_stat_activity;
datname  | usename
--+--
stats| decibel
stats| postgres
postgres | postgres
(3 rows)

AFAIK there's no way I could possibly use or refer to the connection  
to stats at this point; so why doesn't dblink close it when I issue  
the second connect?

--
Decibel!, aka Jim C. Nasby, Database Architect  [EMAIL PROTECTED]
Give your computer some brain candy! www.distributed.net Team #1828



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


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Heikki Linnakangas
Tom Lane wrote:
 Heikki Linnakangas [EMAIL PROTECTED] writes:
 The best I can think of is to rename the obsolete file to
 relfilenode.stale, when it's scheduled for deletion at next
 checkpoint, and check for .stale-suffixed files in GetNewRelFileNode,
 and delete them immediately in DropTableSpace.
 
 This is getting too Rube Goldbergian for my tastes.  What if we just
 make DROP TABLESPACE force a checkpoint before proceeding?

True, that would work. DROP TABLESPACE should be uncommon enough that
the performance hit is ok. We only need to checkpoint if the directory
isn't empty, though I think that's the case more often than not; you're
most likely to drop a tablespace right after dropping all relations in it.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

   http://archives.postgresql.org


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Florian G. Pflug

Heikki Linnakangas wrote:

Tom Lane wrote:

I tend to agree that truncating the file, and extending the fsync
request mechanism to actually delete it after the next checkpoint,
is the most reasonable route to a fix.


Ok, I'll write a patch to do that.


What is the argument against making relfilenodes globally unique by adding the 
xid and epoch of the creating transaction to the filename? Those 64 bits could 
be stuffed into 13 bytes by base-36 encoding (A-Z,0-9). The maximum length of a 
relfilenode would then be 10 + 1 + 13 = 24, which any reasonable filesystem 
should support IMHO.


regards, Florian Pflug


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

  http://www.postgresql.org/docs/faq


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Florian G. Pflug

Heikki Linnakangas wrote:

Tom Lane wrote:

I tend to agree that truncating the file, and extending the fsync
request mechanism to actually delete it after the next checkpoint,
is the most reasonable route to a fix.


Ok, I'll write a patch to do that.


What is the argument against making relfilenodes globally unique by adding the 
xid and epoch of the creating transaction to the filename? Those 64 bits could 
be stuffed into 13 bytes by base-36 encoding (A-Z,0-9). The maximum length of a 
relfilenode would then be 10 + 1 + 13 = 24, which any reasonable filesystem 
should support IMHO.


regards, Florian Pflug

PS: Sorry if this arrives twice - I'm having a few troubles with my mail setup.

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

  http://www.postgresql.org/docs/faq


Re: [HACKERS] dblink un-named connection doesn't get re-used

2007-10-18 Thread Decibel!

Sorry for the self-reply...

On Oct 18, 2007, at 9:09 AM, Decibel! wrote:

Is it intentional that dblink's unnamed connections don't get re-used?


From the dblink docs (both 8.1 and HEAD):

if only one argument is given, the connection is unnamed; only  
one unnamed

connection can exist at a time

So this sounds to me like a bug.
--
Decibel!, aka Jim C. Nasby, Database Architect  [EMAIL PROTECTED]
Give your computer some brain candy! www.distributed.net Team #1828



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

  http://www.postgresql.org/docs/faq


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Heikki Linnakangas
Florian G. Pflug wrote:
 Heikki Linnakangas wrote:
 Tom Lane wrote:
 I tend to agree that truncating the file, and extending the fsync
 request mechanism to actually delete it after the next checkpoint,
 is the most reasonable route to a fix.

 Ok, I'll write a patch to do that.
 
 What is the argument against making relfilenodes globally unique by
 adding the xid and epoch of the creating transaction to the filename?
 Those 64 bits could be stuffed into 13 bytes by base-36 encoding
 (A-Z,0-9). The maximum length of a relfilenode would then be 10 + 1 + 13
 = 24, which any reasonable filesystem should support IMHO.

The size of would be xid + epoch + oid = 96 bits, not 64 bits.

That would work, but sounds like a much bigger change.

sizeof(RelFileNode) would increase from 12 to 20, so any data structure
that deals with RelFileNodes would take more memory. Hash function in
buffer manager would get more expensive. I remember seeing that showing
up in oprofile sometimes, but it'd need to be benchmarked to see if it
really matters.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Tom Lane
Florian G. Pflug [EMAIL PROTECTED] writes:
 What is the argument against making relfilenodes globally unique by adding 
 the 
 xid and epoch of the creating transaction to the filename?

1. Zero chance of ever backpatching.  (I know I said I wasn't excited
   about that, but it's still a strike against a proposed fix.)

2. Adds new fields to RelFileNode, which will be a major code change,
   and possibly a noticeable performance hit (bigger hashtable keys).

3. Adds new columns to pg_class, which is a real PITA ...

4. Breaks oid2name and all similar code that knows about relfilenode.

regards, tom lane

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


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes:
 Bummer. There are lots of ways to break installcheck though - locale
 being one I get biten by all the time...

Hmm, which locale do you use and what breakage do you see?

regards, tom lane

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


Re: [HACKERS] Strange error dropping foreign key

2007-10-18 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes:
 db=# alter table isi.items_stat drop constraint items_stat_item_id_fkey;
 ERROR:  items_pkey is an index

Context please?

regards, tom lane

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

   http://archives.postgresql.org


[HACKERS] Strange error dropping foreign key

2007-10-18 Thread Magnus Hagander
db=# alter table isi.items_stat drop constraint items_stat_item_id_fkey;
ERROR:  items_pkey is an index

The foreign key points to items.Item_id which is what's indexed by items_pkey. 
But I only wanted to drop that constraint.

/Magnus 

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

   http://archives.postgresql.org


[HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
Hi there,

Is it possible to write a dynamic loaded C function as an UDP or TCP server?

What we want to do it is:
Add a search function which send a UDP package to remote UDP server
and then listen to an UDP port, waiting for the result.
Ideally, we don't close the UDP server after the search query end.
So we can reuse it for next search.

Is it possible?

Thanks

Billow


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread D'Arcy J.M. Cain
On Thu, 18 Oct 2007 10:55:19 -0400
Billow Gao [EMAIL PROTECTED] wrote:
 Is it possible to write a dynamic loaded C function as an UDP or TCP server?
 
 What we want to do it is:
 Add a search function which send a UDP package to remote UDP server
 and then listen to an UDP port, waiting for the result.
 Ideally, we don't close the UDP server after the search query end.
 So we can reuse it for next search.
 
 Is it possible?

Short answer: yes.  Slightly longer answer: If you need to ask this
quetion then you should really talk to someone about network
programming but this is the wrong list.

If you are asking if PostgreSQL already does UDP then the answer is
no.  You need to write a server program that talks UDP in one direction
and TCP to PostgreSQL in the other direction.  Watch out for security
issues.

-- 
D'Arcy J.M. Cain [EMAIL PROTECTED] |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.

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

   http://archives.postgresql.org


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
On Thu, 18 Oct 2007 10:55:19 -0400
Billow Gao [EMAIL PROTECTED] wrote:
 Is it possible to write a dynamic loaded C function as an UDP or TCP
server?

 What we want to do it is:
 Add a search function which send a UDP package to remote UDP server
 and then listen to an UDP port, waiting for the result.
 Ideally, we don't close the UDP server after the search query end.
 So we can reuse it for next search.

 Is it possible?

Short answer: yes.  Slightly longer answer: If you need to ask this
quetion then you should really talk to someone about network
programming but this is the wrong list.

Thanks for your reply.

I can write the network program.
But I am not 100% sure whether I can add the c-language function (
http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html)
to PostgreSQL. The function will be dynamic loaded by PostgreSQL.
I want to know whether there are any limitation on the function I wrote.

for example:
If I want to write a function:

PG_FUNCTION_INFO_V1(c_talktoremoteudp);


And use it in PostgreSQL like:

=
SELECT name, c_talktoremoteudp

(emp, 1500) AS overpaid
FROM emp
WHERE name = 'Bill' OR name = 'Sam';

=
The function c_talktoremoteudp will:
1. send udp data to remote udp server
2. monitor an udp port and wait for the reply
3. return the data to the select query.

Anyway, I guess that it can be done. I will write a simple function to test
it.

Ying


If you are asking if PostgreSQL already does UDP then the answer is
no.  You need to write a server program that talks UDP in one direction
and TCP to PostgreSQL in the other direction.  Watch out for security
issues.


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread D'Arcy J.M. Cain
On Thu, 18 Oct 2007 11:24:24 -0400
Billow Gao [EMAIL PROTECTED] wrote:
 I can write the network program.
 But I am not 100% sure whether I can add the c-language function (
 http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html)
 to PostgreSQL. The function will be dynamic loaded by PostgreSQL.
 I want to know whether there are any limitation on the function I wrote.
 
 for example:
 If I want to write a function:
 
 PG_FUNCTION_INFO_V1(c_talktoremoteudp);
 
 
 And use it in PostgreSQL like:
 
 =
 SELECT name, c_talktoremoteudp
 
 (emp, 1500) AS overpaid
 FROM emp
 WHERE name = 'Bill' OR name = 'Sam';
 
 =
 The function c_talktoremoteudp will:
 1. send udp data to remote udp server
 2. monitor an udp port and wait for the reply
 3. return the data to the select query.

I am confused.  The dynamic function resides in the server.  The query
runs in the server.  Where is the remoteness in any of this?  Are you
saying that there is a second server that is not PostgreSQL that uses
UDP that you want to communicate with and merge info into the
PostgreSQL server from?

-- 
D'Arcy J.M. Cain [EMAIL PROTECTED] |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.

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


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Decibel!

On Oct 18, 2007, at 12:07 AM, Bruce Momjian wrote:

Josh Berkus wrote:

On Wednesday 17 October 2007 21:35, Tom Lane wrote:

Josh Berkus [EMAIL PROTECTED] writes:
I'm writing up the new GUCs, and noticed that  
max_prepared_transactions
defaults to 5.  This is too many for most applications (which  
don't use
them at all) and far too few for applications which use them  
regularly.


I think the intention was to have enough so you could test 'em (in
particular, run the regression tests) without eating resources for
the majority of installations that aren't using them.

Certainly an installation that *is* using 'em would want a higher
setting.


Yeah, given the amount of memory per xact, I guess we can't  
actually set the
default higher.  I just hate to see a setting that is liable to  
bite someone

on the tuchas so easily.


They will see the failure at 5 faster and adjust it accordingly.   
If it

was higher they might hit the limit only under heavy load and it would
surprise them.


Actually, the amount of memory is a reason to default to 0, or change  
the name, or put a big comment in the config, because I very often  
saw databases where people had set this to a very high value under  
the impression that it impacted prepared statements.

--
Decibel!, aka Jim C. Nasby, Database Architect  [EMAIL PROTECTED]
Give your computer some brain candy! www.distributed.net Team #1828



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


Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

2007-10-18 Thread Florian G. Pflug

Tom Lane wrote:

Florian G. Pflug [EMAIL PROTECTED] writes:

What is the argument against making relfilenodes globally unique by adding
the xid and epoch of the creating transaction to the filename?


1. Zero chance of ever backpatching.  (I know I said I wasn't excited about
that, but it's still a strike against a proposed fix.)

2. Adds new fields to RelFileNode, which will be a major code change, and
possibly a noticeable performance hit (bigger hashtable keys).

3. Adds new columns to pg_class, which is a real PITA ...

4. Breaks oid2name and all similar code that knows about relfilenode.


Ah, Ok. I was under the impression that relfilenode in pg_class is a string of
some kind. In that case only GetNewRelFileNode would have needed patching...
But that is obviously not the case, as I realized now :-(

Thanks for setting me straight ;-)

regards, Florian Pflug

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

  http://www.postgresql.org/docs/faq


Re: [HACKERS] ts_rewrite aggregate API seems mighty ugly

2007-10-18 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes:

 Gregory Stark [EMAIL PROTECTED] writes:
 The two-argument form may not be actively broken but it sounds not very
 integrated. Passing a string which is then planned as an SQL query is not 
 very
 SQL-ish.

 True.  I'll bet you don't like ts_stat() either.

It seems the right way interface here wouldn't be too different from what's
there. All we need is a SRF which takes a single tsvector and returns the set
of words from it.

Then you could do the aggregates yourself in SQL:

SELECT count(distinct apodid) as ndoc,
   count(*) as nentry,
   element
  FROM (
  SELECT apodid, ts_elements(vector) AS element
FROM apod
) GROUP BY element

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com

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


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Gregory Stark
D'Arcy J.M. Cain [EMAIL PROTECTED] writes:

 On Thu, 18 Oct 2007 11:24:24 -0400
 And use it in PostgreSQL like:
 
 =
 SELECT name, c_talktoremoteudp(emp, 1500) AS overpaid
 FROM emp
 WHERE name = 'Bill' OR name = 'Sam';
 
 =
 The function c_talktoremoteudp will:
 1. send udp data to remote udp server
 2. monitor an udp port and wait for the reply
 3. return the data to the select query.

 I am confused.  The dynamic function resides in the server.  The query
 runs in the server.  Where is the remoteness in any of this?  Are you
 saying that there is a second server that is not PostgreSQL that uses
 UDP that you want to communicate with and merge info into the
 PostgreSQL server from?

Yeah, what he wants is to implement a function in Postgres which does
something like an LDAP or DNS lookup or something like that.

Sure you can do this. The only tricky bit is the thing you mentioned about
reusing the connection. You could always leave the connection in a safe state
and don't need to worry about cleaning it up then you could just store it in a
static variable which would be the simplest option.

If you want to use Postgres's facilities for allocating memory and cleaning it
up when no longer in use you can use some of the Postgres internal API for
memory contexts and resource owners. But I don't see any particular reason you
should need to worry about this stuff for something simple you're implementing
yourself.

-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Gregory Stark

Decibel! [EMAIL PROTECTED] writes:

 Actually, the amount of memory is a reason to default to 0, or change  the
 name, or put a big comment in the config, because I very often  saw databases
 where people had set this to a very high value under  the impression that it
 impacted prepared statements.

There's another cost associated with prepared transactions. If it's set to 0
then there's no real reason we need to wal log lock operations.


-- 
  Gregory Stark
  EnterpriseDB  http://www.enterprisedb.com

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
Thanks.  This is what I want to know :-)

Regards,

Billow

Yeah, what he wants is to implement a function in Postgres which does
something like an LDAP or DNS lookup or something like that.

Sure you can do this. The only tricky bit is the thing you mentioned about
reusing the connection. You could always leave the connection in a safe
state
and don't need to worry about cleaning it up then you could just store it
in a
static variable which would be the simplest option.

If you want to use Postgres's facilities for allocating memory and cleaning
it
up when no longer in use you can use some of the Postgres internal API for
memory contexts and resource owners. But I don't see any particular reason
you
should need to worry about this stuff for something simple you're
implementing
yourself.



On 10/18/07, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote:

 On Thu, 18 Oct 2007 11:24:24 -0400
 Billow Gao [EMAIL PROTECTED] wrote:
  I can write the network program.
  But I am not 100% sure whether I can add the c-language function (
  http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html)
  to PostgreSQL. The function will be dynamic loaded by PostgreSQL.
  I want to know whether there are any limitation on the function I wrote.
 
  for example:
  If I want to write a function:
 
  PG_FUNCTION_INFO_V1(c_talktoremoteudp);
 
 
  And use it in PostgreSQL like:
 
  =
  SELECT name, c_talktoremoteudp
 
  (emp, 1500) AS overpaid
  FROM emp
  WHERE name = 'Bill' OR name = 'Sam';
 
  =
  The function c_talktoremoteudp will:
  1. send udp data to remote udp server
  2. monitor an udp port and wait for the reply
  3. return the data to the select query.

 I am confused.  The dynamic function resides in the server.  The query
 runs in the server.  Where is the remoteness in any of this?  Are you
 saying that there is a second server that is not PostgreSQL that uses
 UDP that you want to communicate with and merge info into the
 PostgreSQL server from?

 --
 D'Arcy J.M. Cain [EMAIL PROTECTED] |  Democracy is three wolves
 http://www.druid.net/darcy/|  and a sheep voting on
 +1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.

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



Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Kevin Grittner
 On Thu, Oct 18, 2007 at 11:23 AM, in message
[EMAIL PROTECTED], Gregory Stark [EMAIL PROTECTED]
wrote: 
 
 If it's set to 0
 then there's no real reason we need to wal log lock operations.
 
Do we currently take advantage of that fact, or log them anyway?
 
-Kevin
 



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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Jan de Visser
On Thursday 18 October 2007 12:27:59 Billow Gao wrote:
 Thanks.  This is what I want to know :-)

 Regards,

 Billow

 Yeah, what he wants is to implement a function in Postgres which does
 something like an LDAP or DNS lookup or something like that.
 
 Sure you can do this. The only tricky bit is the thing you mentioned about
 reusing the connection. You could always leave the connection in a safe
  state and don't need to worry about cleaning it up then you could just
  store it in a static variable which would be the simplest option.
 
 If you want to use Postgres's facilities for allocating memory and
  cleaning it up when no longer in use you can use some of the Postgres
  internal API for memory contexts and resource owners. But I don't see any
  particular reason you should need to worry about this stuff for something
  simple you're implementing yourself.

 On 10/18/07, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote:
  On Thu, 18 Oct 2007 11:24:24 -0400

 Billow Gao [EMAIL PROTECTED] wrote:
  I can write the network program.
  ...

Oh my. The worst kind of top-poster: the kind that copies *your* reply from 
the bottom to the top and top-posts above that.

Shudder...

:)

jan

-- 
--
Jan de Visser                     [EMAIL PROTECTED]

                Baruk Khazad! Khazad ai-menu!
--

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] max_prepared_transactions default ... why 5?

2007-10-18 Thread Heikki Linnakangas
Kevin Grittner wrote:
 On Thu, Oct 18, 2007 at 11:23 AM, in message
 [EMAIL PROTECTED], Gregory Stark [EMAIL PROTECTED]
 wrote: 
  
 If it's set to 0
 then there's no real reason we need to wal log lock operations.
  
 Do we currently take advantage of that fact, or log them anyway?

No, we log them anyway.

There's a few other reasons to WAL log lock operations, see comments in
heap_lock_tuple:

 /*
  * XLOG stuff.You might think that we don't need an XLOG record 
 because
  * there is no state change worth restoring after a crash.You would be
  * wrong however: we have just written either a TransactionId or a
  * MultiXactId that may never have been seen on disk before, and we need
  * to make sure that there are XLOG entries covering those ID numbers.
  * Else the same IDs might be re-used after a crash, which would be
  * disastrous if this page made it to disk before the crash.  Essentially
  * we have to enforce the WAL log-before-data rule even in this case.
  * (Also, in a PITR log-shipping or 2PC environment, we have to have XLOG
  * entries for everything anyway.)
  */

There's also the risk of torn pages. We set the xmax and the XMAX_*_LOCK
flag in heap_lock_tuple, and it's possible that only one of those
changes is written to disk before crash.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Merlin Moncure
On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
 Merlin Moncure [EMAIL PROTECTED] writes:
  There was a very similar proposal a little while back (google:
  array_to_set).  I think I like those names better since you are
  returning a set, not an iterator :-).

 I agree, this is a very poor choice of name.  There should be some
 reference to arrays in it, for one thing.

 generate_array_subscripts() maybe?

array_to_set or array_expand seem a little better imo (shorter, and
symmetry with array_accum()), unless you want to differentiate between
internal funcs (array_cat and the like) vs. user funcs.

I would prefer a proper C implementation to a solution based around
generate_series().  I'm doing a lot of C funcs lately and would be
happy taking a stab at this...

merlin

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


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes:
 On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
 generate_array_subscripts() maybe?

 array_to_set or array_expand seem a little better imo (shorter, and
 symmetry with array_accum()), unless you want to differentiate between
 internal funcs (array_cat and the like) vs. user funcs.

I don't much like either of those, because they seem misleading:
what I'd expect from a function named that way is that it returns
the *elements* of the array, not their subscripts.

Come to think of it, do we have a way of doing that directly?  If you
only care about accessing the array elements, it seems like dealing in
the subscripts is just notational tedium.  Perhaps there should be
array_expand(anyarray) returns setof anyelement, in addition to the
subscript generation function.

On the question of being too long, I could live with
generate_subscripts().

regards, tom lane

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


Re: [HACKERS] upgrade from 8.0.3 to 8.1.10 crash

2007-10-18 Thread Boergesson, Cheryl
I found when I removed all comments, it worked fine.  Any ideas?

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boergesson,
Cheryl
Sent: Thursday, October 18, 2007 9:24 AM
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] upgrade from 8.0.3 to 8.1.10 crash

 

Hello.  I am trying to upgrade from PostgreSQL 8.0.3 to PostgreSQL
8.1.10.  I'm on WindowsXP and I'm compiling with Visual C++ 6.0.

 

I have a very simple routine that works fine with the 8.0.3 version:

 

int easy_connect()

{

exec sql connect to my_db as my_cnxtn;

printf (connection results:\n);

printf (code: %d\n, sqlca.sqlcode);

printf (state: %s\n, sqlca.sqlstate);

printf (warn: %s\n, sqlca.sqlwarn);

exec sql begin work;

exec sql commit work;

return 0;

}

 

When I use the 8.1.10 version, the connection works ( sqlca.sqlcode is
0, sqlca.sqlstate is  and sqlca.sqlwarn is blank).  But it then
crashes on the exec sql begin work line.

 

I get the following error in a window:

 

Runtime Error!

 

Program: C:\testSQL.exe

 

This application has requested the Runtime to terminate it in an unusual
way.

Please contact the application's support team for more information.

 

I removed the 8.0.3 version using remove program from the control
panel.  I then went and removed my C:\Program Files\PostgreSQL\8.0
folder, just to make sure I was not including the wrong header files,
linking to the wrong libraries, or calling the wrong version of
ecpg.exe.

 

Thanks for any help.

-Cheryl

 



Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Merlin Moncure
On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
 I don't much like either of those, because they seem misleading:
 what I'd expect from a function named that way is that it returns
 the *elements* of the array, not their subscripts.

 Come to think of it, do we have a way of doing that directly?  If you
 only care about accessing the array elements, it seems like dealing in
 the subscripts is just notational tedium.  Perhaps there should be
 array_expand(anyarray) returns setof anyelement, in addition to the
 subscript generation function.

 On the question of being too long, I could live with
 generate_subscripts().

how about array_iota?

merlin

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


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes:
 On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
 On the question of being too long, I could live with
 generate_subscripts().

 how about array_iota?

I think a lot of people wouldn't get the reference.  How about
array_subscripts()?

regards, tom lane

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Joe Conway

Tom Lane wrote:

Merlin Moncure [EMAIL PROTECTED] writes:

On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:

generate_array_subscripts() maybe?



array_to_set or array_expand seem a little better imo (shorter, and
symmetry with array_accum()), unless you want to differentiate between
internal funcs (array_cat and the like) vs. user funcs.


I don't much like either of those, because they seem misleading:
what I'd expect from a function named that way is that it returns
the *elements* of the array, not their subscripts.

Come to think of it, do we have a way of doing that directly?  If you
only care about accessing the array elements, it seems like dealing in
the subscripts is just notational tedium.  Perhaps there should be
array_expand(anyarray) returns setof anyelement, in addition to the
subscript generation function.


I think what you're describing is the SQL2003 UNNEST feature.

Joe

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


Re: [HACKERS] upgrade from 8.0.3 to 8.1.10 crash

2007-10-18 Thread Alvaro Herrera
Boergesson, Cheryl wrote:
 I found when I removed all comments, it worked fine.  Any ideas?

I suggest you add ECPG to the subject line so that the relevant
developers notice your problem.


-- 
Alvaro Herrera http://www.amazon.com/gp/registry/CTMLCN8V17R4
The Postgresql hackers have what I call a NASA space shot mentality.
 Quite refreshing in a world of weekend drag racer developers.
(Scott Marlowe)

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


[HACKERS] ECPG crash - upgrade from 8.0.3 to 8.1.10

2007-10-18 Thread Boergesson, Cheryl
Hello.  I am trying to upgrade from PostgreSQL 8.0.3 to PostgreSQL
8.1.10.  I'm on WindowsXP and I'm compiling with Visual C++ 6.0.

 

I have a very simple routine that works fine with the 8.0.3 version:

 

int easy_connect()

{

exec sql connect to my_db as my_cnxtn;

printf (connection results:\n);

printf (code: %d\n, sqlca.sqlcode);

printf (state: %s\n, sqlca.sqlstate);

printf (warn: %s\n, sqlca.sqlwarn);

exec sql begin work;

exec sql commit work;

return 0;

}

 

When I use the 8.1.10 version, the connection works ( sqlca.sqlcode is
0, sqlca.sqlstate is  and sqlca.sqlwarn is blank).  But it then
crashes on the exec sql begin work line.

 

I get the following error in a window:

 

Runtime Error!

 

Program: C:\testSQL.exe

 

This application has requested the Runtime to terminate it in an unusual
way.

Please contact the application's support team for more information.

 

I removed the 8.0.3 version using remove program from the control
panel.  I then went and removed my C:\Program Files\PostgreSQL\8.0
folder, just to make sure I was not including the wrong header files,
linking to the wrong libraries, or calling the wrong version of
ecpg.exe.

 

Oddly, when I removed all comments, it worked fine.

 

Thanks for any help.

-Cheryl

 



Re: [HACKERS] Release notes introductory text

2007-10-18 Thread Kevin Grittner
 On Thu, Oct 18, 2007 at 12:34 AM, in message
[EMAIL PROTECTED], Bruce Momjian [EMAIL PROTECTED] wrote:

 This release represents a major leap forward for PostgreSQL by adding
 significant new functionality and performance enhancements. This was
 made possible by a growing community that has dramatically accelerated
 the pace of development. This release adds the follow major
 capabilities:
 
If we want to have a short intro to promote the new release,
this sounds good to me.
 
-Kevin
 



---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Merlin Moncure
On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
 Merlin Moncure [EMAIL PROTECTED] writes:
  On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
  On the question of being too long, I could live with
  generate_subscripts().

  how about array_iota?

 I think a lot of people wouldn't get the reference.  How about
 array_subscripts()?


works for me..

merlin

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


[HACKERS] I've discovered an error with the tcl pgmail function

2007-10-18 Thread qljsystems
Further to the thread

Re: Send email from PostgreSQL, may I ?

* From: Devrim GUNDUZ devrim ( at ) commandprompt ( dot ) com
* To: Gerson Machado gersonamach ( at ) yahoo ( dot ) com ( dot ) br
* Subject: Re: Send email from PostgreSQL, may I ?
* Date: Fri, 27 Oct 2006 16:07:00 +0300


There's a suggested function in pltclu to send emails from the postgre database.

I've worked with this and discovered that there's an error which causes the
email to be sent with a blank subject and the subject to be included as part of
the body.

To overcome this, the following should be done:

comment out or remove the two lines:-

puts $ServerSocket To: $mailto;# To:
puts $ServerSocket From: $mailfrom;# From:

Regards,

Quentin

---
This mail sent through http://webmail.zoom.co.uk

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


Re: [HACKERS] I've discovered an error with the tcl pgmail function

2007-10-18 Thread Tom Lane
[EMAIL PROTECTED] writes:
 There's a suggested function in pltclu to send emails from the postgre 
 database.

There's no such function anywhere in the core Postgres distribution,
so I think you've reported this to the wrong place.

regards, tom lane

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


Re: [HACKERS] Proposal: generate_iterator functions

2007-10-18 Thread Pavel Stehule
done

http://www.pgsql.cz/index.php/Iter%C3%A1tor_pole

I'll send patch later

Pavel

2007/10/18, Merlin Moncure [EMAIL PROTECTED]:
 On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
  Merlin Moncure [EMAIL PROTECTED] writes:
   On 10/18/07, Tom Lane [EMAIL PROTECTED] wrote:
   On the question of being too long, I could live with
   generate_subscripts().
 
   how about array_iota?
 
  I think a lot of people wouldn't get the reference.  How about
  array_subscripts()?


 works for me..

 merlin


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

   http://www.postgresql.org/docs/faq


Re: [HACKERS] dblink un-named connection doesn't get re-used

2007-10-18 Thread Joe Conway

Decibel! wrote:

Is it intentional that dblink's unnamed connections don't get re-used?


yes


stats=# select dblink_connect('dbname=stats');
dblink_connect

OK
(1 row)

stats=# select dblink_connect('dbname=postgres');
dblink_connect

OK
(1 row)


AFAIK there's no way I could possibly use or refer to the connection to 
stats at this point; so why doesn't dblink close it when I issue the 
second connect?


Why doesn't C free allocated memory automatically if you reassign a pointer?

No one has ever complained before, so I can't imagine that the resource 
leak is much of an issue in real world cases. But if you don't like the 
behavior, patches are gratefully accepted ;-).


Seriously though, I can change it for 8.3, but is it really worth 
back-patching?


Joe

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


Re: [HACKERS] [COMMITTERS] pgsql: Consistently indent release notes for prior releases.

2007-10-18 Thread Tom Lane
[EMAIL PROTECTED] (Bruce Momjian) writes:
 Consistently indent release notes for prior releases.

Bruce, if you don't revert that patch I will do it for you.  Random
changes to the release.sgml sections for old releases are an utter
nightmare when it comes time to produce back-branch updates.

regards, tom lane

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


Re: [HACKERS] upgrade from 8.0.3 to 8.1.10 crash

2007-10-18 Thread Tom Lane
Boergesson, Cheryl [EMAIL PROTECTED] writes:
 I found when I removed all comments, it worked fine.  Any ideas?

Oh?  Considering that the fragments you've shown us have never had
one single comment, that means that no one could possibly have offered
you any useful advice.

Please, if you would like help with this sort of problem, show a complete
self-contained test case.  Leaving stuff out is counterproductive, way
too often.

regards, tom lane

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


[HACKERS] Re: [COMMITTERS] pgsql: Consistently indent release notes for prior releases.

2007-10-18 Thread Bruce Momjian
Tom Lane wrote:
 [EMAIL PROTECTED] (Bruce Momjian) writes:
  Consistently indent release notes for prior releases.
 
 Bruce, if you don't revert that patch I will do it for you.  Random
 changes to the release.sgml sections for old releases are an utter
 nightmare when it comes time to produce back-branch updates.

The problem is that we use those back branches as templates for new
minor releases.  I could have just done 8.2.X but I figured I should be
consistent.

I am not sure why it affects back branch updates.  The way I create back
branches is to modify release.sgml in HEAD and then copy that file to
the back branches, and cutt off the top part of release.sgml for the
appropriate branch.

Also I also don't understand why you are threatening to revert it before
even complaining about it to me.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

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