RE: [HACKERS] Re: pg_ctl default shutdown mode

2001-02-10 Thread Peter Eisentraut

Hiroshi Inoue writes:

> > Since there were no comments, I'm going to make fast shutdown the default.
> >
>
> Oh I've misunderstood.
> I object to the change.

Do you feel the current behaviour is more intuitive?  Just curious.  I
just think that waiting by default and smart shutdown don't really mix
well.

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




[HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Peter Eisentraut

Bruce Momjian writes:

> I have applied the following patch to properly exit ODBC.  I also
> patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
> under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
> libc and crt1.o to be resolved before creating the shared library.

The -Bsymbolic switch is the same on all platforms that have it.  You can
link without it, but then you won't actually be able to use the ODBC
driver.  It seems like you need to link in a few other libraries to
resolve all symbols.

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




[HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> Bruce Momjian writes:
> 
> > I have applied the following patch to properly exit ODBC.  I also
> > patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
> > under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
> > libc and crt1.o to be resolved before creating the shared library.
> 
> The -Bsymbolic switch is the same on all platforms that have it.  You can
> link without it, but then you won't actually be able to use the ODBC
> driver.  It seems like you need to link in a few other libraries to
> resolve all symbols.

OK, if this is true on all platforms, why isn't -lc needed?

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu

2001-02-10 Thread Bruce Momjian

> > Bruce Momjian writes:
> > 
> > > I have applied the following patch to properly exit ODBC.  I also
> > > patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
> > > under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
> > > libc and crt1.o to be resolved before creating the shared library.
> > 
> > The -Bsymbolic switch is the same on all platforms that have it.  You can
> > link without it, but then you won't actually be able to use the ODBC
> > driver.  It seems like you need to link in a few other libraries to
> > resolve all symbols.
> 
> OK, if this is true on all platforms, why isn't -lc needed?
> 

And if -lc is somehow done by default with ld -Bsymbolic, how do I deal
with a link that accesses crt1.o startup symbols, like environ and
__progname?


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [ODBC] Re: [PATCHES] Fix for ODBC closeu

2001-02-10 Thread Bruce Momjian

> > > Bruce Momjian writes:
> > > 
> > > > I have applied the following patch to properly exit ODBC.  I also
> > > > patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
> > > > under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
> > > > libc and crt1.o to be resolved before creating the shared library.
> > > 
> > > The -Bsymbolic switch is the same on all platforms that have it.  You can
> > > link without it, but then you won't actually be able to use the ODBC
> > > driver.  It seems like you need to link in a few other libraries to
> > > resolve all symbols.
> > 
> > OK, if this is true on all platforms, why isn't -lc needed?
> > 
> 
> And if -lc is somehow done by default with ld -Bsymbolic, how do I deal
> with a link that accesses crt1.o startup symbols, like environ and
> __progname?
> 

OK, the following fixes the link on BSDI, while allowing -Bsymbolic.  I
have to explicitly include -R crt1.o to be used to resolve symbols, but
not to be linked in.  Without -R, I get undefined 'main' which makes
sense.

I am still confused why other OS's work, unless -lc is assumed by ld,
and their libc's have no crt1.o references.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026


Index: src/interfaces/odbc/GNUmakefile
===
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/GNUmakefile,v
retrieving revision 1.9
diff -c -r1.9 GNUmakefile
*** src/interfaces/odbc/GNUmakefile 2001/02/10 05:50:27 1.9
--- src/interfaces/odbc/GNUmakefile 2001/02/10 11:26:13
***
*** 36,43 
  # BSD/OS fails with libc and crt1.o undefined symbols without this.
  # bjm 2001-02-09
  #
- ifneq ($(PORTNAME), bsdi)
  LINK.shared += $(shlib_symbolic)
  endif
  
  odbc_headers = isql.h isqlext.h iodbc.h
--- 36,44 
  # BSD/OS fails with libc and crt1.o undefined symbols without this.
  # bjm 2001-02-09
  #
  LINK.shared += $(shlib_symbolic)
+ ifeq ($(PORTNAME), bsdi)
+ SHLIB_LINK += -lc -R /usr/lib/crt1.o
  endif
  
  odbc_headers = isql.h isqlext.h iodbc.h



[HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Peter Eisentraut

Bruce Momjian writes:

> > The -Bsymbolic switch is the same on all platforms that have it.  You can
> > link without it, but then you won't actually be able to use the ODBC
> > driver.  It seems like you need to link in a few other libraries to
> > resolve all symbols.
>
> OK, if this is true on all platforms, why isn't -lc needed?

Theory 1:  Many other platforms use the compiler driver ([g]cc) to link
shared libraries.  That makes all the right things happen.  Most likely
this should happen on a lot more platforms that currently use ld directly.

Theory 2:  Not many people have tried to build the ODBC driver on
non-mainstream platforms.

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




[HACKERS] Open 7.1 items

2001-02-10 Thread Bruce Momjian

I have removed the following open item by adding the other mysql
conversion utility to the CVS tree in /contrib/mysql:

Merge MySQL/PgSQL translation scripts

If someone wants to merge them and make one script out of them, go
ahead.  Both are BSD licensed now.

The only remaining source code items are pretty exotic and will have to
be discussed.  Thanks for shrinking this list so fast.

---


  P O S T G R E S Q L

 7 . 1  O P E NI T E M S


Current at ftp://candle.pha.pa.us/pub/postgresql/open_items.


Source Code Changes
---
LAZY VACUUM (Vadim)
visibility of joined columns in JOIN clauses
Stuck btree spinlocks


Documentation Changes
-
JDBC improvements (Peter, Travis Bauer, Christopher Cain, William Webber,
Gunnar)
ODBC cleanups/improvements (Nick Gorham, Stephan Szabo, Zoltan Kovacs, 
Michael Fork)
New ALTER TABLE ADD CONSTRAINT (Stephan)
New PL/pgSQL GET DIAGNOSTICS statement for SPI value access (Jan)
Store tables as files named by OID (Vadim)
New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
New /contrib/rserv replication toolkit (Vadim)
New /contrib/oid2name to map numeric files to table names (B Palmer)
New pg_class.relkind value for views (Mark Hollomon)
Moved macmanuf to /contrib (Larry Rosenman)
Allow NetBSD's libedit instead of readline (Peter)
Improve PL/PgSQL documenation (?)

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> Bruce Momjian writes:
> 
> > > The -Bsymbolic switch is the same on all platforms that have it.  You can
> > > link without it, but then you won't actually be able to use the ODBC
> > > driver.  It seems like you need to link in a few other libraries to
> > > resolve all symbols.
> >
> > OK, if this is true on all platforms, why isn't -lc needed?
> 
> Theory 1:  Many other platforms use the compiler driver ([g]cc) to link
> shared libraries.  That makes all the right things happen.  Most likely
> this should happen on a lot more platforms that currently use ld directly.
> 
> Theory 2:  Not many people have tried to build the ODBC driver on
> non-mainstream platforms.

I just tried gcc and got:

#$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o
columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o
misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o
parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o 
-L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26
gcc: unrecognized option `-soname'
gcc: file path prefix `symbolic' never used


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] Re: [GENERAL] MySQL -> Postgres dump converter

2001-02-10 Thread Bruce Momjian

OK, I have added this conversion scripts to CVS along with Thomas's.  If
someone wants to merge them into one, feel free to submit a patch.  I
have provided a URL to my2pg.pl to retrieve the most recent version.

The only license issue was that the bottom of the source code had a
mention referring to the GPL for more information.  I removed that
because it now clearly states it has a BSD-like license.

Thanks.

> > Can some PostgreSQL people comment on this?  This person wrote a
> > MySQL->PostgreSQL converter too.  His version is at:
> > http://ziet.zhitomir.ua/~fonin/code
> 
> -- THIS VERSION IS EXTREMELY BUGSOME ! USE IT ON YOUR OWN RISK !!!
> 
> Hmm. My version does not have this feature, but it could be added ;)
> 
> Seriously, I haven't looked at the differences, but there is a licensing
> difference (BSD vs GPL). Someone else with experience with MySQL should
> evaluate both packages.
> 
> mysql2pgsql has been used to convert SourceForge, with ~90 tables and
> moderately complicated schema, but that did not include enumerated types
> (done with ints at SF) and "unique" keys (done with sequences at SF)
> afaicr.
> 
> > Sucks found:...
> 
> Each is a one-liner to fix in mysql2pgsql. The (nonstandard) types
> mentioned weren't used in the test cases I had available. I didn't
> realize that we had *any* reports of troubles or lacking features in the
> existing converter, but I'll leave it up to y'all to decide if the
> licensing issues and feature issues are significant.
> 
> I'm willing to provide patches to address some of the concerns, but of
> course will not be able to look at the GPL'd code for hints and can only
> use the information posted here to help afaik.
> 
> Comments?
> 
>- Thomas
> 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Peter Eisentraut

Bruce Momjian writes:

> I just tried gcc and got:
>
> #$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o
> columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o
> misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o
> parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o
> -L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26
> gcc: unrecognized option `-soname'
> gcc: file path prefix `symbolic' never used

Try gcc -shared -Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic ...

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




RE: [HACKERS] Re: pg_ctl default shutdown mode

2001-02-10 Thread Hiroshi Inoue

> -Original Message-
> From: Peter Eisentraut [mailto:[EMAIL PROTECTED]]
> 
> Hiroshi Inoue writes:
> 
> > > Since there were no comments, I'm going to make fast shutdown 
> the default.
> > >
> >
> > Oh I've misunderstood.
> > I object to the change.
> 
> Do you feel the current behaviour is more intuitive?

Yes.

> Just curious.  I
> just think that waiting by default and smart shutdown don't really mix
> well.
> 

Current behavior prevents manual shutdown from cancelling
running sessions carelessly. 
OTOH it's the dba's responsibilty to write appropriate shutdown
scripts and it's not good to rely on default in writing them in the
first place.

Regards,
Hiroshi Inoue



Re: [HACKERS] SourceForge & Postgres

2001-02-10 Thread Oleg Bartunov

Tim,

I've found your message in postgres hackers list and wondering if
sourceforge db part could be improved using our recent (7.1) GiST improvements.

In short, using RD-Tree + GiST we've added index support for arrays of
integers. For example, in our rather busy web site we have pool
of online news. Most complex query to construct main page is
select messages from given list of categories, because it requires
join from  message_section_map (message could belong to several
categories).
messagesmessage_section_map
---
msg_id  msg_id
title   sect_id
.

WHERE clause (simplificated) looks like
..
message_section_map.sect_id in 
(1,13,103,10488,105,17,9,4,2,26373,12,7,8,14,5,6,11,15,
10339,10338,10336,10335,26404,26405,26403,206) and
message_section_map.msg_id = messages.msg_id order by publication_date
desc .

This is really difficult query and takes a long time to execute.

now, we exclude message_section_map, just add array  to
table messages which contains all sect_id given message belong to.
Using our index support for arrays of int4  our complex query
executes very fast !

I think sourceforge uses some kind of such queries.

Some info about GiST extension and our contribution could be find
at http://www.sai.msu.su/~megera/postgres/gist/


Regards,
Oleg
_
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




Re: [HACKERS] Re: pg_ctl default shutdown mode

2001-02-10 Thread Bruce Momjian

> > Just curious.  I
> > just think that waiting by default and smart shutdown don't really mix
> > well.
> > 
> 
> Current behavior prevents manual shutdown from cancelling
> running sessions carelessly. 
> OTOH it's the dba's responsibilty to write appropriate shutdown
> scripts and it's not good to rely on default in writing them in the
> first place.

Yes, but too many people do stupid things.  If they are smart enough to
write a script, they are smart enough to use a flag to make it do what
they want it to do.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> Bruce Momjian writes:
> 
> > I just tried gcc and got:
> >
> > #$ gcc -shared -soname libpsqlodbc.so.0 -Bsymbolic info.o bind.o
> > columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o
> > misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o
> > parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o
> > -L/usr/local/lib -L/usr/contrib/lib -lm -o libpsqlodbc.so.0.26
> > gcc: unrecognized option `-soname'
> > gcc: file path prefix `symbolic' never used
> 
> Try gcc -shared -Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic ...

OK, this works:

gcc -shared -Wl,-Bsymbolic,-soname,libpsqlodbc.so.0 info.o bind.o
columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o
misc.o options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o
parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o 
-L/usr/local/lib -L/usr/contrib/lib -lm  -lc -o libpsqlodbc.so.0.26

I replaced the 'ld' with 'gcc -Wl', and that prevents the need for the
crt1.o.

It still requires -lc:

ifneq ($(PORTNAME), bsdi)
LINK.shared += $(shlib_symbolic)
else
LINK.shared = gcc -shared -Wl,-Bsymbolic,-soname,$(soname)
SHLIB_LINK += -lc
endif

It seems the -Bsymbolic needs the gcc, while other links are OK with ld.
We may find this is true on many platforms.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [DOCS] Open 7.1 items

2001-02-10 Thread Bruce Momjian

> Bruce Momjian writes:
> 
> >> Allow location of Unix domain socket to be configurable (David J. MacKenzie)
> >> Allow postmaster to listen on a specific IP address (David J. MacKenzie)
> >> Allow socket path name to be specified in hostname by using leading slash
> >> (David J. MacKenzie)
> >> Allow CREATE DATABASE to specify template database (Tom)
> 
> The four items listed are all documented to at least some extent (ie,
> I find them each in at least one place in the SGML docs).  Whether they
> are documented adequately is another question...

I believe these are done.  I did them when I applied the Uunet patches. 
If I missed a spot, someone please let me know.

Items removed.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: pg_ctl default shutdown mode

2001-02-10 Thread Tom Lane

"Hiroshi Inoue" <[EMAIL PROTECTED]> writes:
>> From: Peter Eisentraut [mailto:[EMAIL PROTECTED]]
>> Just curious.  I
>> just think that waiting by default and smart shutdown don't really mix
>> well.

> Current behavior prevents manual shutdown from cancelling
> running sessions carelessly. 

Seems that pg_ctl is being made to serve two different purposes:
one, manual shutdown, and two, automated shutdown during system-wide
shutdown.  In the second case, 'fast' shutdown is the appropriate thing,
but in the first case I think 'smart' shutdown is definitely the safer
and more appropriate default.

So, how to resolve that conflict?  I think it's better for the script
default to cater to the manual-invocation case, because you're more
likely to forget to add the switch when you're entering the command by
hand.  When pg_ctl is invoked from a system shutdown script, you only
have to get it right once, and then the script remembers for you ;-).

In short: I agree with Hiroshi on this one.  Let's leave the script
default at 'smart' shutdown, and make it clear in the documentation
that "-mode fast" is the best way to invoke it from a system-shutdown
script.

regards, tom lane



Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Peter Eisentraut

Bruce Momjian writes:

> I replaced the 'ld' with 'gcc -Wl', and that prevents the need for the
> crt1.o.
>
> It still requires -lc:
>
>   ifneq ($(PORTNAME), bsdi)
>   LINK.shared += $(shlib_symbolic)
>   else
>   LINK.shared = gcc -shared -Wl,-Bsymbolic,-soname,$(soname)
>   SHLIB_LINK += -lc
>   endif

You can't hardcode "gcc" like that.  I've committed some fixes that should
work for you.  Please try them out.  Also try to build libpq++.

> It seems the -Bsymbolic needs the gcc, while other links are OK with ld.
> We may find this is true on many platforms.

-Bsymbolic requires all symbols in the library to be resolvable at link
time.  If you use 'ld' then you will need to provide all the appropriate
files yourself.  The compiler driver normally does that automatically.

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> You can't hardcode "gcc" like that.  I've committed some fixes that should
> work for you.  Please try them out.  Also try to build libpq++.
> 
> > It seems the -Bsymbolic needs the gcc, while other links are OK with ld.
> > We may find this is true on many platforms.
> 
> -Bsymbolic requires all symbols in the library to be resolvable at link
> time.  If you use 'ld' then you will need to provide all the appropriate
> files yourself.  The compiler driver normally does that automatically.
> 

Great.  I see you modified Makefile.bsdi to properly know it is being
used with gcc, and modified Makefile.shlib.  Perfect.

Should other platforms have this fix too?  We didn't need it before
-Bsymbolic, but it seems it would be safe to do for FreeBSD and a few
others.


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: pg_ctl default shutdown mode

2001-02-10 Thread Bruce Momjian

> So, how to resolve that conflict?  I think it's better for the script
> default to cater to the manual-invocation case, because you're more
> likely to forget to add the switch when you're entering the command by
> hand.  When pg_ctl is invoked from a system shutdown script, you only
> have to get it right once, and then the script remembers for you ;-).
> 
> In short: I agree with Hiroshi on this one.  Let's leave the script
> default at 'smart' shutdown, and make it clear in the documentation
> that "-mode fast" is the best way to invoke it from a system-shutdown
> script.

Agreed.  Default to the best mode for manual usage.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] New setval() call

2001-02-10 Thread Bruce Momjian

I am inclinded to remove this open item:

New SQL function setval(seq,val,bool) for use in pg_dump (Philip)

The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
of general use, so we probably don't need to document it.  Is this valid?

Info on the new param is:

---

IRC the point of the nextval() is to ensure that the internal state of
the sequence is correct.  There's a bool "is_called" in the sequence
that means something like "I've been nextval()'d at least once", and the
only clean way to make that become set is to issue a nextval.  You can
watch the behavior by doing "select * from sequenceobject" between
sequence commands --- it looks like the first nextval() simply sets
is_called without changing last_value, and then subsequent nextval()s
increment last_value.  (This peculiar arrangement makes it possible
to have a starting value equal to MININT, should you want to do so.)
So pg_dump needs to make sure it restores the correct setting of both
fields.

This is pretty grotty because it looks like there's no way to clear
is_called again, short of dropping and recreating the sequence.
So unless you want to do that always, a data-only restore couldn't
guarantee to restore the state of a virgin sequence.


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> > -Bsymbolic requires all symbols in the library to be resolvable at link
> > time.  If you use 'ld' then you will need to provide all the appropriate
> > files yourself.  The compiler driver normally does that automatically.
> > 
> 
> Great.  I see you modified Makefile.bsdi to properly know it is being
> used with gcc, and modified Makefile.shlib.  Perfect.
> 
> Should other platforms have this fix too?  We didn't need it before
> -Bsymbolic, but it seems it would be safe to do for FreeBSD and a few
> others.

I have applied the following patch for OpenBSD and FreeBSD.  They have
the same -Bsymbolic handling and same use of LD for linking.  I made the
duplicate changes Peter made for BSDI.

Can anyone commend on the use of 'ld -x' to delete all local symbols?
FreeBSD and OpenBSD have it, while BSD/OS does not.  I added it to BSDi,
and it seems to work fine.

Actually, it seems NetBSD already had all these fixes.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026


Index: src/Makefile.shlib
===
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/Makefile.shlib,v
retrieving revision 1.41
diff -c -r1.41 Makefile.shlib
*** src/Makefile.shlib  2001/02/10 16:51:39 1.41
--- src/Makefile.shlib  2001/02/10 17:16:06
***
*** 112,118 
  ifeq ($(PORTNAME), openbsd)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifdef ELF_SYSTEM
! LINK.shared   = $(LD) -x -Bshareable -soname $(soname)
else
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
endif
--- 112,119 
  ifeq ($(PORTNAME), openbsd)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifdef ELF_SYSTEM
! LINK.shared   = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
! SHLIB_LINK+= -lc
else
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
endif
***
*** 121,127 
  ifeq ($(PORTNAME), bsdi)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifeq ($(DLSUFFIX), .so)
! LINK.shared   = $(COMPILER) -shared -Wl,-soname,$(soname)
  SHLIB_LINK+= -lc
endif
ifeq ($(DLSUFFIX), .o)
--- 122,128 
  ifeq ($(PORTNAME), bsdi)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifeq ($(DLSUFFIX), .so)
! LINK.shared   = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
  SHLIB_LINK+= -lc
endif
ifeq ($(DLSUFFIX), .o)
***
*** 132,138 
  ifeq ($(PORTNAME), freebsd)
ifdef ELF_SYSTEM
  shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
! LINK.shared   = $(LD) -x -shared -soname $(soname)
else
  shlib := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
--- 133,140 
  ifeq ($(PORTNAME), freebsd)
ifdef ELF_SYSTEM
  shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
! LINK.shared   = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
! SHLIB_LINK+= -lc
else
  shlib := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
***
*** 142,148 
  ifeq ($(PORTNAME), netbsd)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifdef ELF_SYSTEM
! LINK.shared   = $(COMPILER) -shared -Wl,-soname,$(soname)
else
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
endif
--- 144,150 
  ifeq ($(PORTNAME), netbsd)
shlib   := 
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifdef ELF_SYSTEM
! LINK.shared   = $(COMPILER) -shared -Wl,-x,-soname,$(soname)
else
  LINK.shared   = $(LD) -x -Bshareable -Bforcearchive
endif
Index: src/makefiles/Makefile.freebsd
===
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/makefiles/Makefile.freebsd,v
retrieving revision 1.13
diff -c -r1.13 Makefile.freebsd
*** src/makefiles/Makefile.freebsd  2000/12/16 18:14:25 1.13
--- src/makefiles/Makefile.freebsd  2001/02/10 17:16:07
***
*** 3,9 
  ifdef ELF_SYSTEM
  export_dynamic = -export-dynamic
  rpath = -R$(libdir)
! shlib_symbolic = -Bsymbolic
  endif
  
  DLSUFFIX = .so
--- 3,9 
  ifdef ELF_SYSTEM
  export_dynamic = -export-dynamic
  rpath = -R$(libdir)
!

Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Peter Eisentraut

Bruce Momjian writes:

> I have applied the following patch for OpenBSD and FreeBSD.  They have
> the same -Bsymbolic handling and same use of LD for linking.  I made the
> duplicate changes Peter made for BSDI.

Hmm, at least on OpenBSD the recommended way to build shared libraries is
using 'ld' directly.  But using gcc should work as well.

> Can anyone commend on the use of 'ld -x' to delete all local symbols?
> FreeBSD and OpenBSD have it, while BSD/OS does not.  I added it to BSDi,
> and it seems to work fine.

I don't think it should be used.

> Actually, it seems NetBSD already had all these fixes.

On NetBSD, there are about 4 different ways of build shared libraries,
depending on version and platform.  Nothing I wanna mess with.

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/




Re: [HACKERS] Re: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

> Bruce Momjian writes:
> 
> > I have applied the following patch for OpenBSD and FreeBSD.  They have
> > the same -Bsymbolic handling and same use of LD for linking.  I made the
> > duplicate changes Peter made for BSDI.
> 
> Hmm, at least on OpenBSD the recommended way to build shared libraries is
> using 'ld' directly.  But using gcc should work as well.

> > Can anyone commend on the use of 'ld -x' to delete all local symbols?
> > FreeBSD and OpenBSD have it, while BSD/OS does not.  I added it to BSDi,
> > and it seems to work fine.
> 
> I don't think it should be used.

Can someone comment on why people would have added that?

> 
> > Actually, it seems NetBSD already had all these fixes.
> 
> On NetBSD, there are about 4 different ways of build shared libraries,
> depending on version and platform.  Nothing I wanna mess with.

Yes, BSDI has even more, but I think we are now doing the same thing on
all the bsd's.  Interesting that NetBSD was the only "right" one.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] Distributed lock manager

2001-02-10 Thread Bruce Momjian

Here is info about distributed lock manager by IBM:

  http://oss.software.ibm.com/developerworks/opensource/linux/projects/dlm/

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



Re: [HACKERS] New setval() call

2001-02-10 Thread Philip Warner

At 12:23 10/02/01 -0500, Bruce Momjian wrote:
>I am inclinded to remove this open item:
>
>   New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
>
>The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
>of general use, so we probably don't need to document it.  Is this valid?
>
>Info on the new param is:

Fine with me; I think your recollection is correct - but it would be worth
putting a description *somewhere*. Do we have an internals doc of any kind?
Something that describes interfaces etc that are not guaranteed to remain
static or supported?



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.B.N. 75 008 659 498)  |  /(@)   __---_
Tel: (+61) 0500 83 82 81 | _  \
Fax: (+61) 0500 83 82 82 | ___ |
Http://www.rhyme.com.au  |/   \|
 |----
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/



Re: [HACKERS] New setval() call

2001-02-10 Thread Bruce Momjian

> At 12:23 10/02/01 -0500, Bruce Momjian wrote:
> >I am inclinded to remove this open item:
> >
> > New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
> >
> >The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
> >of general use, so we probably don't need to document it.  Is this valid?
> >
> >Info on the new param is:
> 
> Fine with me; I think your recollection is correct - but it would be worth
> putting a description *somewhere*. Do we have an internals doc of any kind?
> Something that describes interfaces etc that are not guaranteed to remain
> static or supported?

Can you give me a few lines to put in sequence.c?  There isn't even
anything in there!

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] Re: [ODBC] RE: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

OK, I have ifdef'ed out the sending of the 'X' parameter.  I will see if
placing it somewhere else will help.  Could it have to do with the fact
we are in a transaction in ODBC?  My guess is that the X is returning
data that is triggering the error.

[ Charset ISO-8859-1 unsupported, converting... ]
> 
> 
> > -Original Message-
> > From: Bruce Momjian [mailto:[EMAIL PROTECTED]]
> > Sent: 10 February 2001 05:46
> > To: PostgreSQL odbc list; PostgreSQL-patches
> > Cc: PostgreSQL-development
> > Subject: [PATCHES] Fix for ODBC close
> > 
> > 
> > I have applied the following patch to properly exit ODBC. 
> 
> 
> 
> I just compiled from the current cvs under win32 and I still get
> 'pq_recvbuf: unexpected EOF on client connection' when exiting apps using
> the ODBC driver. I have tested with pgAdmin which uses ADO (ActiveX Data
> Objects) and certainly closes the ADO connection object on exit, as well as
> a simple test app using DAO (Data Access Objects). I did have a go at fixing
> this myself when Bruce first mentioned it, and had exactly the same results
> with similar code :-(
> 
> Regards, 
> 
> Dave.
> 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] ODBC driver issue in MS Access

2001-02-10 Thread Patrick Dunford

I installed the ODBC driver for Postgre, and linked in a table which has a
Serial field for the primary key. In MS Access, the type is shown as just
"Number (long integer)".

When I try to add new records to my database in Access, I don't put anything
into the key field because the server is supposed to generate it
automatically. But when my record is sent back to the server, it rejects it
and Access displays "#Deleted" in all of the fields. Is this because Postgre
can't fill in the key field and so rejects it as an integrity constraint
violation? I don't get any errors from Access.

Should my database create its own key values and store them itself?

===
Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/

   In this way, love is made complete among us so that we will have
confidence on the day of judgment, because in this world we are
like him.
-- 1 John 4:17
http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010210
===
Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/




[HACKERS] ODBC backward versions

2001-02-10 Thread Bruce Momjian

I checked the logs, and we released the new 6.4 backend protocol on
1998-10-30.  That was 2.5 years ago.

We normally allow older clients to communicate with newer servers, but
often we don't support newer clients talking to older servers, sometimes
even servers one release in the past.  The reason is that the backend
communication code gets confusing.  For example, I know there were some
libpq releases that could not talk to servers from the previous release.
We did allow newer servers to talk to older clients because it is harder
to upgrade many clients than a single server.

Seems the <=6.3 compatibility code in our current ODBC is just adding
confusion for coders and users and should be removed.  Tom Lane agreed.

If someone thinks it should be kept, please speak up.

Thanks.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



[HACKERS] RE: ODBC driver issue in MS Access

2001-02-10 Thread Patrick Dunford

But then a funny thing happened. When I refreshed the view, the records
changed from "#Deleted" to all the data I put in, and the serial field was
filled in with the correct value. How do I stop that from happening?

> -Original Message-
> From: Patrick Dunford [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, 11 February 2001 14:59
> To: PostgreSQL List
> Subject: ODBC driver issue in MS Access
>
>
> I installed the ODBC driver for Postgre, and linked in a table
> which has a Serial field for the primary key. In MS Access, the
> type is shown as just "Number (long integer)".
>
> When I try to add new records to my database in Access, I don't
> put anything into the key field because the server is supposed to
> generate it automatically. But when my record is sent back to the
> server, it rejects it and Access displays "#Deleted" in all of
> the fields. Is this because Postgre can't fill in the key field
> and so rejects it as an integrity constraint violation? I don't
> get any errors from Access.
>
> Should my database create its own key values and store them itself?
>
> ===
> Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/
>
>In this way, love is made complete among us so that we will have
> confidence on the day of judgment, because in this world we are
> like him.
> -- 1 John 4:17
> http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010210
> ===
> Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/
>




Re: [HACKERS] pgAccess fails to launch on HPUX

2001-02-10 Thread Tatsuo Ishii

> If I had known that this was possible I would have done it myself already.
> ;-)  This is a good idea in general because in a default installation
> pgaccess won't find libpgtcl on any system because it doesn't have the
> benefit of the -rpath/-R business.  Please review/remove the note at the

Really? On my RedHat 6.2 derived Linux distribution pgaccess
successfully finds libpgtcl.so without any problem. (using Tcl8.0)
--
Tatsuo Ishii



[HACKERS] Re: [ODBC] RE: [PATCHES] Fix for ODBC close

2001-02-10 Thread Bruce Momjian

OK, I have a pretty good guess about the cause of the ODBC shutdown
failure message in the server logs.  Sending 'X' is still causing the
error message.

The error you are seeing is from the backend libpq code, the area that
communicates with clients.

So, let's assume the problem is not the platform, but the client code. 
Libpq properly shuts connections without triggering that message.  ODBC
does trigger the message.

libpq closes connections with:

(void) pqPuts("X", conn);
(void) pqFlush(conn);

while ODBC closes with:

SOCK_put_char(self, 'X');
SOCK_flush_output(self);

They then close() the socket.

It seems the difference is in the flushing.  libpq has elaborate flush
code:

while (len > 0)
{
sent = send(conn->sock, ptr, len, 0);
len -= sent;

if (pqWait(FALSE, TRUE, conn))
}

and pqWait does:

if (select(conn->sock + 1, &input_mask, &output_mask, (fd_set *) NULL,


For flush, ODBC does a simple:

written = send(self->socket, (char *) self->buffer_out, 
self->buffer_filled_out, 0);


It seems we may need to add flush code similar to libpq in ODBC.

At a minimum, we have to put the send() in a loop and keep going until
there are no more bytes to send.  Not sure the select() is required.

Comments?

After I receive comments, I will prepare a patch people can test.


---



.  > OK, I have ifdef'ed out the sending of the 'X' parameter.  I will see if
> placing it somewhere else will help.  Could it have to do with the fact
> we are in a transaction in ODBC?  My guess is that the X is returning
> data that is triggering the error.
> 
> [ Charset ISO-8859-1 unsupported, converting... ]
> > 
> > 
> > > -Original Message-
> > > From: Bruce Momjian [mailto:[EMAIL PROTECTED]]
> > > Sent: 10 February 2001 05:46
> > > To: PostgreSQL odbc list; PostgreSQL-patches
> > > Cc: PostgreSQL-development
> > > Subject: [PATCHES] Fix for ODBC close
> > > 
> > > 
> > > I have applied the following patch to properly exit ODBC. 
> > 
> > 
> > 
> > I just compiled from the current cvs under win32 and I still get
> > 'pq_recvbuf: unexpected EOF on client connection' when exiting apps using
> > the ODBC driver. I have tested with pgAdmin which uses ADO (ActiveX Data
> > Objects) and certainly closes the ADO connection object on exit, as well as
> > a simple test app using DAO (Data Access Objects). I did have a go at fixing
> > this myself when Bruce first mentioned it, and had exactly the same results
> > with similar code :-(
> > 
> > Regards, 
> > 
> > Dave.
> > 
> 
> 
> -- 
>   Bruce Momjian|  http://candle.pha.pa.us
>   [EMAIL PROTECTED]   |  (610) 853-3000
>   +  If your life is a hard drive, |  830 Blythe Avenue
>   +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026
> 


-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026