[BUGS] BUG #3276: unique index/unique constraint

2007-05-14 Thread michael

The following bug has been logged online:

Bug reference:  3276
Logged by:  michael
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2.4
Operating system:   winxp
Description:unique index/unique constraint
Details: 

from postgresql irc, one says:

the docs say: "When an index is declared unique, multiple table rows with
equal indexed values will not be allowed. Null values are not considered
equal. A multicolumn unique index will only reject cases where all of the
indexed columns are equal in two rows."



my program's case:

CREATE TABLE account_category
(
account_category_id varchar(38), -- guid, not nullable, primary key

sub_account_of varchar(38), 
/* guid, nullable, links to account_category_id if the account_category is
sub-level of another account_category, makes the table tree-structured */


account_category varchar(50), -- not nullable, e.g.  INCOME, Bank Interest,
Union Bank, China Bank, Commission

account_category_full_description varhar(509), -- could allowed ten levels
of recursion :-)
/* quickbooks' like data structure, chained by trigger, e.g. INCOME,
INCOME:Bank Interest, INCOME:Bank 
Interest:Union Bank, INCOME:Bank Interest:China Bank, INCOME:Commission */


)


creating unique key in sub_account_of+account_category:

CREATE UNIQUE INDEX uk_account_category
  ON account_category
  USING btree
  (sub_account_of, upper(account_category::text));




-- allowed
insert into account_category(account_category_id, sub_account_of,
account_category) SELECT newid(), NULL, 'INCOME'; 


-- second insert of same values allowed.  because the SQL standard says
so??
insert into account_category(account_category_id, sub_account_of,
account_category) SELECT newid(), NULL, 'INCOME'; 




postgresql and mysql, behaves in same way. i.e. allow two rows of NULL,
'INCOME'




while mssql unique constraint, doesn't allowed duplicate NULL + INCOME


ALTER TABLE account_category ADD CONSTRAINT uk_account_category
UNIQUE(sub_account_of,account_category)  


this IMHO, mssql breaks the standard with fashion :-)





with regards to unique rows, i think we should deviate from the sql
standard.  or if this isn't possible, we should at least document this in
postgresql's unique index/unique constraint's gotchas, make more obvious. 
i'm really surprised that two rows with equal values is allowed





btw, thanks to davidfetter and oicu for suggesting partial index for my
program's "unique" case :-)



CREATE UNIQUE INDEX uk_account_category_topmost
  ON account_category
  USING btree
  (upper(account_category::text))
  WHERE sub_account_of IS NULL;



CREATE UNIQUE INDEX uk_account_category_sublevel
  ON account_category
  USING btree
  (sub_account_of, upper(account_category::text));

---(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


[BUGS] BUG #3277: error occurs between different versions

2007-05-14 Thread Nilay Ceter

The following bug has been logged online:

Bug reference:  3277
Logged by:  Nilay Ceter
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2.3
Operating system:   windows
Description:error occurs between different versions
Details: 

We are developing a network based application, using postgre sql.

Earlier version has been developed using Postgre SQL 8.0 and there was no
problem.

But we use Postgre SQL 8.2 in new version and we are experiencing some
problems about our sql commands.

The command line:

select seri_no, ad as baslik, kull_ref as Kullanıcı_Referansi, sorumlu
from onay,dokuman where p_id='yonetici' and onay.dokuman_id=dokuman.seri_no
and onay_durum.seri_no=seri_no and onay_durum.p_id='yonetici' and
(dokuman.durum=1 or dokuman.durum=2 or dokuman.durum=6 or dokuman.durum=7)
and onay_durum.durum=0 and seri_no>0


was working properly in Postgre SQL 8.0 but in version Postgre SQL 8.2 the
second "and" gives an error.
And it is :

" Project dym.exe raised exception class EPSQLDatabaseError with message
'PostgreSQL Error Code : (1)
ERROR: missing FROM-clause entry for table "onay_durum" at character 152'
.Process stopped.Use Step or Run to continue. "

would you please help us?

Best Regards

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


Re: [BUGS] BUG #3277: error occurs between different versions

2007-05-14 Thread Heikki Linnakangas

Nilay Ceter wrote:

The command line:

select seri_no, ad as baslik, kull_ref as Kullanıcı_Referansi, sorumlu
from onay,dokuman where p_id='yonetici' and onay.dokuman_id=dokuman.seri_no
and onay_durum.seri_no=seri_no and onay_durum.p_id='yonetici' and
(dokuman.durum=1 or dokuman.durum=2 or dokuman.durum=6 or dokuman.durum=7)
and onay_durum.durum=0 and seri_no>0


was working properly in Postgre SQL 8.0 but in version Postgre SQL 8.2 the
second "and" gives an error.
And it is :

" Project dym.exe raised exception class EPSQLDatabaseError with message
'PostgreSQL Error Code : (1)
ERROR: missing FROM-clause entry for table "onay_durum" at character 152'
.Process stopped.Use Step or Run to continue. "


I don't understand how that query could have worked on PostgreSQL 8.0 
either. There's no table or alias with name "onay_durum" in the FROM clause.


Are you sure this is the exactly same query you tried on PostgreSQL 8.0?

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

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


Re: [BUGS] BUG #3277: error occurs between different versions

2007-05-14 Thread Magnus Hagander
On Mon, May 14, 2007 at 09:44:05AM +0100, Heikki Linnakangas wrote:
> Nilay Ceter wrote:
> >The command line:
> >
> >select seri_no, ad as baslik, kull_ref as Kullanıcı_Referansi, 
> >sorumlu
> >from onay,dokuman where p_id='yonetici' and onay.dokuman_id=dokuman.seri_no
> >and onay_durum.seri_no=seri_no and onay_durum.p_id='yonetici' and
> >(dokuman.durum=1 or dokuman.durum=2 or dokuman.durum=6 or dokuman.durum=7)
> >and onay_durum.durum=0 and seri_no>0
> >
> >
> >was working properly in Postgre SQL 8.0 but in version Postgre SQL 8.2 the
> >second "and" gives an error.
> >And it is :
> >
> >" Project dym.exe raised exception class EPSQLDatabaseError with message
> >'PostgreSQL Error Code : (1)
> >ERROR: missing FROM-clause entry for table "onay_durum" at character 152'
> >.Process stopped.Use Step or Run to continue. "
> 
> I don't understand how that query could have worked on PostgreSQL 8.0 
> either. There's no table or alias with name "onay_durum" in the FROM clause.
> 
> Are you sure this is the exactly same query you tried on PostgreSQL 8.0?

Seems to be dependant on the config parameter add_missing_from. The default
changed between 8.0 and 8.1 from on to off.

Nilay, you can try setting add_missing_from=on in postgresql.conf and
reload the service to fix this. Or better yet, fix your query to reference
all tables in the from clause.

//Magnus


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


Re: [BUGS] BUG #3277: error occurs between different versions

2007-05-14 Thread Klint Gore
On Mon, 14 May 2007 09:44:05 +0100, Heikki Linnakangas <[EMAIL PROTECTED]> 
wrote:
> Nilay Ceter wrote:
> > The command line:
> >
> > select seri_no, ad as baslik, kull_ref as Kullanıcı_Referansi, sorumlu
> > from onay,dokuman where p_id='yonetici' and onay.dokuman_id=dokuman.seri_no
> > and onay_durum.seri_no=seri_no and onay_durum.p_id='yonetici' and
> > (dokuman.durum=1 or dokuman.durum=2 or dokuman.durum=6 or dokuman.durum=7)
> > and onay_durum.durum=0 and seri_no>0
> >
> >
> > was working properly in Postgre SQL 8.0 but in version Postgre SQL 8.2 the
> > second "and" gives an error.
> > And it is :
> >
> > " Project dym.exe raised exception class EPSQLDatabaseError with message
> > 'PostgreSQL Error Code : (1)
> > ERROR: missing FROM-clause entry for table "onay_durum" at character 152'
> > .Process stopped.Use Step or Run to continue. "
>
> I don't understand how that query could have worked on PostgreSQL 8.0
> either. There's no table or alias with name "onay_durum" in the FROM clause.
>
> Are you sure this is the exactly same query you tried on PostgreSQL 8.0?

Didn't the default in postgresql.conf for add_missing_from change in 8.1?

klint.

+---+-+
: Klint Gore: "Non rhyming:
: EMail   : [EMAIL PROTECTED]   :  slang - the:
: Snail   : A.B.R.I.:  possibilities  :
: Mail  University of New England   :  are useless"   :
:   Armidale NSW 2351 Australia : L.J.J.  :
: Fax : +61 2 6772 5376 : :
+---+-+

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

   http://archives.postgresql.org


RE : Re: [BUGS] BUG #3271: PREPARE/EXCUTE don't work

2007-05-14 Thread Laurent FAILLIE
Hi Heikki,

--- Heikki Linnakangas <[EMAIL PROTECTED]> a
écrit :

> > www=> PREPARE authn_dbd_1 (varchar) AS select mdp
> from mariage.comptes where
> > nom = '$1';
> 
> That $1 should be without the quotes, like this:
> 
> PREPARE authn_dbd_1 (varchar) AS select mdp from
> mariage.comptes where 
> nom = $1
> 
> Otherwise the query looks for a user named '$1'.

Ok, it's working, thanks a log.
So, Apache DBD module is faulty, I will try to solve
out this issue and revert it back to apache team.

Thanks agains.

Laurent


The misspelling master is on the Web.
   _100 % Dictionnary Free !
  //(
 /  Dico  / /   Pleins d'autres fautes sur
// /
(###( / http://destroyedlolo.homeunix.org
Quoi, des fautes d'orthographe! Pas possible ;-D.


  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

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

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


Re: [BUGS] BUG #3276: unique index/unique constraint

2007-05-14 Thread Tom Lane
"michael" <[EMAIL PROTECTED]> writes:
> with regards to unique rows, i think we should deviate from the sql
> standard.

That's not happening.

> or if this isn't possible, we should at least document this in
> postgresql's unique index/unique constraint's gotchas, make more obvious. 

It is documented ... you just quoted the docs.

> i'm really surprised that two rows with equal values is allowed

It is not the case that "NULL = NULL", so why would you think that the
two rows are equal?

You probably need to rethink what you are using NULL for in this table.
It's really only good for cases where you mean to indicate that a value
is unknown.

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


Re: [BUGS] INSTALL appnote for Solaris 10...

2007-05-14 Thread Bruce Momjian

Feel free to submit a diff against the current Solaris FAQ.

---

Zdenek Kotala wrote:
> John R Pierce wrote:
> > I just built a version of postgres 8.2.4 on Solaris 10 x86 ... a few 
> > things that could be mentioned in INSTALL, and or in the Solaris notes
> 
> Solaris.FAQ is best place for it.
> http://www.postgresql.org/docs/faqs.FAQ_Solaris.html
> 
> 
> > 
> > Solaris has a `crle` command that performs a function similar to 
> > ldconfig of the BSD systems. To globally add libreadline and libsl 
> > to the library path, I used...
> > 
> >  crle -l /lib:/usr/lib:/opt/sfw/lib:/usr/sfw/lib
> > 
> > if you only wanted to do this for a single user, then put the following 
> > in that user's profile,
> > 
> >  export LD_LIBRARY_PATH; LD_LIBRARY_PATH=/opt/sfw/lib:/usr/sfw/lib
> > 
> > for compilation, set the path as..
> > 
> >export PATH; PATH=/usr/bin:/opt/SUNWspro/bin:/usr/sfw/bin:/usr/ccs/bin
> > 
> 
> Better way is use -R linker switch:
> 
> LDFLAGS="-R /opt/sfw/lib:/usr/sfw/lib"
> 
> > 
> > The contrib/start-scripts/freebsd worked adequately as 
> > /etc/init.d/postgres if I removed the -l from the `su` commands.
> 
> On Solaris 10 SMF is recommended instead standard start stop scripts. 
> You can get SMF script for example there:
> 
> http://www.sun.com/software/solaris/howtoguides/postgresqlhowto.jsp#2
> or
> http://src.opensolaris.org/source/xref/sfw/usr/src/cmd/postgres/postgresql-8.2/Solaris/
> 
> 
>   Zdenek
> 
> ---(end of broadcast)---
> TIP 2: Don't 'kill -9' the postmaster

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

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

---(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


[BUGS] BUG #3278: PSQLException when using setBinaryStream via JDBC

2007-05-14 Thread jeffrey zhao

The following bug has been logged online:

Bug reference:  3278
Logged by:  jeffrey zhao
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.2.4-1
Operating system:   Windows XP
Description:PSQLException when using setBinaryStream via JDBC
Details: 

When I run the following program, I got an exception as following:

File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = conn.prepareStatement("INSERT INTO images VALUES (?,
?)");
ps.setString(1, file.getName());
ps.setBinaryStream(2, fis, file.length());
ps.executeUpdate();
ps.close();
fis.close();

Exception: 

org.postgresql.util.PSQLException: Method
org.postgresql.jdbc4.Jdbc4PreparedStat
ement.setBinaryStream(int, InputStream, long) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:728)
at
org.postgresql.jdbc4.AbstractJdbc4Statement.setBinaryStream(AbstractJ
dbc4Statement.java:70)

Is the method setBinaryStream really not yet implemented?

Thanks.

---(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


[BUGS] BUG #3279: insert or update

2007-05-14 Thread

The following bug has been logged online:

Bug reference:  3279
Logged by:  
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.1
Operating system:   macosx
Description:insert or update
Details: 

I sort of want to begin this with 'Hey, a--h---e.' I've got my code working
for MySQL and then Sqlite and now I'm breaking my back on PostgreSQL. I'm
not concerned with purity of code or algorithmic beauty or anything else.
What I've got is I can't use the same standard query language queries on
each database. Everybody does the standard different, which means it is
broken. If I had started with MySQL, it would be broken, but instead it's
Postgres I'm working last on, so it's PostgreSQL that is broken.

You know by the short description what the problem is. I've read enough of
your mail lists to know this issue has been brought up again and again. What
I can't find yet is whether anybody has a work around. If you have, trigger
function or some other c--p, why not just make it very public. Right now the
only solution I have is try the INSERT, if it's an error, parse the query,
find out what the primary key is (somehow), and rewrite it as update, which
is a lot of work just so PostgreSQL can maintain it's idealic purity.

(Update then insert doesn't work for all databases because some databases
report zero rows updated unless a value is actually changed: updating a row
to the same current values reports zero rows updated. So that suggestion
requires that I create my own standardised query language and then translate
that to each database's peculiar SQL.)

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


Re: [BUGS] BUG #3278: PSQLException when using setBinaryStream via JDBC

2007-05-14 Thread Kris Jurka



On Mon, 14 May 2007, jeffrey zhao wrote:


The following bug has been logged online:

Bug reference:  3278

When I run the following program, I got an exception as following:

ps.setBinaryStream(2, fis, file.length());
org.postgresql.util.PSQLException: Method
org.postgresql.jdbc4.Jdbc4PreparedStat
ement.setBinaryStream(int, InputStream, long) is not yet implemented.

Is the method setBinaryStream really not yet implemented?



JDBC4 added a setBinaryStream(int, InputStream, long) method which has not 
been implemented yet.  JDBC2 offers setBinaryStream(int, InputStream, int) 
which is implmented.  So you'll need to cast the last parameter to an 
integer to make it work with the current driver.


Kris Jurka

---(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: [BUGS] BUG #3279: insert or update

2007-05-14 Thread Stefan Kaltenbrunner
[EMAIL PROTECTED] wrote:
> The following bug has been logged online:
> 
> Bug reference:  3279
> Logged by:  
> Email address:  [EMAIL PROTECTED]
> PostgreSQL version: 8.1
> Operating system:   macosx
> Description:insert or update
> Details: 
> 
> I sort of want to begin this with 'Hey, a--h---e.' I've got my code working
> for MySQL and then Sqlite and now I'm breaking my back on PostgreSQL. I'm
> not concerned with purity of code or algorithmic beauty or anything else.
> What I've got is I can't use the same standard query language queries on
> each database. Everybody does the standard different, which means it is
> broken. If I had started with MySQL, it would be broken, but instead it's
> Postgres I'm working last on, so it's PostgreSQL that is broken.
> 
> You know by the short description what the problem is. I've read enough of
> your mail lists to know this issue has been brought up again and again. What
> I can't find yet is whether anybody has a work around. If you have, trigger
> function or some other c--p, why not just make it very public. Right now the
> only solution I have is try the INSERT, if it's an error, parse the query,
> find out what the primary key is (somehow), and rewrite it as update, which
> is a lot of work just so PostgreSQL can maintain it's idealic purity.

http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
- example 37-1

the actual "standard" way to do that is by using MERGE with afaik
neither MySQL nor SQLite implement - but the correct solution is
documented and not really difficult to find.


Stefan

---(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


[BUGS] postgresql locks up over the net

2007-05-14 Thread Peter T. Breuer

When talking across a net connection, the 8.1.8-1 client eventually hangs
waiting for a reply to a query that the 7.4.7-6 server misses:

CLIENT:

1) send(3, "Q\0\0\0009SELECT key FROM records WHE"..., 58, 0) = 58
   rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
   poll([{fd=3, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
2) recv(3, "T\0\0\0\34\0\1key\0\0\1\22e\0\1\0\0\0\27\0\4\377\377\377"..., 
16384, 0) = 65
   rt_sigprocmask(SIG_BLOCK, [PIPE], [], 8) = 0
3) send(3, "Q\0\0\1\232UPDATE records SET magic = "..., 411, 0) = 411
   rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
   poll([{fd=3, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1
4) recv(3, "C\0\0\0\rUPDATE 1\0Z\0\0\0\5I", 16384, 0) = 20
   rt_sigprocmask(SIG_BLOCK, [PIPE], [], 8) = 0
5) send(3, "Q\0\0\0008SELECT name from names WHER"..., 57, 0) = 57
   rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
   poll(STUCK...


SERVER:

1) recv(8, "Q\0\0\0009SELECT key FROM records WHE"..., 8192, 0) = 58
   gettimeofday({1179180003, 769584}, NULL) = 0
   send(5, "\4\0\0\0\254\0\0\0\2\0\0\0\215V\0\0\276I\0\0d\0\0\0\2\0"..., 172, 
0) =   172
2) send(8, "T\0\0\0\34\0\1key\0\0\1\22e\0\1\0\0\0\27\0\4\377\377\377"..., 65, 
0) =   65
3) recv(8, "Q\0\0\1\232UPDATE records SET magic = "..., 8192, 0) = 411
   gettimeofday({1179180003, 839197}, NULL) = 0
   time(NULL)  = 1179180003
   _llseek(42, 8142848, [8142848], SEEK_SET) = 0
   write(42, "Z\320\1\0\22\0\0\0\0\0\0\0\0@|\2\234\0\0\0\315\253\315"..., 8192) 
= 8  192
   fdatasync(0x2a) = 0
   send(5, "\4\0\0\0\254\0\0\0\2\0\0\0\215V\0\0\276I\0\0d\0\0\0\2\0"..., 172, 
0) =   172
4) send(8, "C\0\0\0\rUPDATE 1\0Z\0\0\0\5I", 20, 0) = 20
   recv(8, ... STUCK...



The server never received the client's send (5) on client channel 3,
server channel 8. It's waiting for a communication that it missed.

This works fine to localhost (i.e. 8.1 to 8.1). How can the server miss
a send from a client?  What received the send from the client? The
client thinks it went out!  Surely this is tcp?  Apparently not!  Is
there some way of saying to use tcp?  I suppose insisting on ssl would
do.


Peter


---(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: [BUGS] Removing pg_auth_members.grantor (was Grantor name gets lost when grantor role dropped)

2007-05-14 Thread Alvaro Herrera
Alvaro Herrera wrote:

> 2. decide that the standard is braindead and just omit dumping the
>grantor when it's no longer available, but don't remove
>pg_auth_members.grantor
> 
> Which do people feel should be implemented?  I can do whatever we
> decide; if no one has a strong opinion on the matter, my opinion is we
> do (2) which is the easiest.

Here is a patch implementing this idea, vaguely based on Russell's.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: src/bin/pg_dump/pg_dumpall.c
===
RCS file: /home/alvherre/cvs/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.90
diff -c -p -r1.90 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c	10 Feb 2007 14:58:55 -	1.90
--- src/bin/pg_dump/pg_dumpall.c	14 May 2007 23:13:43 -
*** dumpRoleMembership(PGconn *conn)
*** 702,709 
  
  	res = executeQuery(conn, "SELECT ur.rolname AS roleid, "
  	   "um.rolname AS member, "
! 	   "ug.rolname AS grantor, "
! 	   "a.admin_option "
  	   "FROM pg_auth_members a "
  	   "LEFT JOIN pg_authid ur on ur.oid = a.roleid "
  	   "LEFT JOIN pg_authid um on um.oid = a.member "
--- 702,709 
  
  	res = executeQuery(conn, "SELECT ur.rolname AS roleid, "
  	   "um.rolname AS member, "
! 	   "a.admin_option, "
! 	   "ug.rolname AS grantor "
  	   "FROM pg_auth_members a "
  	   "LEFT JOIN pg_authid ur on ur.oid = a.roleid "
  	   "LEFT JOIN pg_authid um on um.oid = a.member "
*** dumpRoleMembership(PGconn *conn)
*** 717,730 
  	{
  		char	   *roleid = PQgetvalue(res, i, 0);
  		char	   *member = PQgetvalue(res, i, 1);
! 		char	   *grantor = PQgetvalue(res, i, 2);
! 		char	   *option = PQgetvalue(res, i, 3);
  
  		fprintf(OPF, "GRANT %s", fmtId(roleid));
  		fprintf(OPF, " TO %s", fmtId(member));
  		if (*option == 't')
  			fprintf(OPF, " WITH ADMIN OPTION");
! 		fprintf(OPF, " GRANTED BY %s;\n", fmtId(grantor));
  	}
  
  	PQclear(res);
--- 717,740 
  	{
  		char	   *roleid = PQgetvalue(res, i, 0);
  		char	   *member = PQgetvalue(res, i, 1);
! 		char	   *option = PQgetvalue(res, i, 2);
  
  		fprintf(OPF, "GRANT %s", fmtId(roleid));
  		fprintf(OPF, " TO %s", fmtId(member));
  		if (*option == 't')
  			fprintf(OPF, " WITH ADMIN OPTION");
! 
! 		/*
! 		 * We don't track the grantor very carefully in the backend, so cope
! 		 * with the possibility that it has been dropped.
! 		 */
! 		if (!PQgetisnull(res, i, 3))
! 		{
! 			char	*grantor = PQgetvalue(res, i, 3);
! 
! 			fprintf(OPF, " GRANTED BY %s", fmtId(grantor));
! 		}
! 		fprintf(OPF, ";\n");
  	}
  
  	PQclear(res);

---(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: [BUGS] postgresql locks up over the net

2007-05-14 Thread Tom Lane
"Peter T. Breuer" <[EMAIL PROTECTED]> writes:
> When talking across a net connection, the 8.1.8-1 client eventually hangs
> waiting for a reply to a query that the 7.4.7-6 server misses:

What platforms are the client and server running on?  What sort of
networking junk is in between?  Are there any significant delays between
the queries?  (I'm wondering in particular about NAT routers dropping
connections due to idle timeouts...)

regards, tom lane

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

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


[BUGS] strange problem with ip6

2007-05-14 Thread Brian Hirt
I have postgresql installed on a mac, and I'm connecting from another  
mac on the network using ip6.   When I  try to select out of  
pg_stat_activity i get this error.  I suspect the %en0 has something  
to do with the problem, but I'm no IP6 expert.


load=# select * from pg_stat_activity ;
ERROR:  invalid input syntax for type inet: "fe80::216:cbff:fe84:8ac2% 
en0"

load=# select version();
version
 

PostgreSQL 8.2.4 on i386-apple-darwin8.9.1, compiled by GCC i686- 
apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5341)

(1 row)

load=#

Any thoughts?

--brian



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

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