AW: AW: [HACKERS] setuid functions, a solution to the RI privilege problem

2000-09-18 Thread Zeugswetter Andreas SB


 But the pg_shadow authentication is based on credentials 
 provided by the
 client whereas what you propose here would run on the server, so this
 doesn't make sense. 

Since you can write extensions to PostgreSQL that reach far into the OS,
it does make sense to execute those extensions under a "non priviledged"
user, and not postgres. This OS user would somehow be tied to the username
that the client passes as his credentials (and that we trust to be
authenticated).

This is actually not my idea, it is implemented in Informix, DB2 and I think
Oracle.

Andreas



Re: [HACKERS] broken locale in 7.0.2 without multibyte support(FreeBSD 4.1-RELEASE) ?

2000-09-18 Thread Peter Eisentraut

Tom Lane writes:

 Well, we could fix it either by propagating use of "unsigned char" all
 over the place, or by casting the arguments given to ctype macros.
 The former would be a lot more invasive because it would propagate to
 routines that don't actually call any ctype macros (since they'd have
 to conform to prototypes, struct definitions, etc).

I'm not married to either solution, I just opine that it is cleaner to use
"signed char" and "unsigned char" explicitly when you depend on the
signed-ness. Otherwise you might just end up moving the problem elsewhere,
namely those structs and prototypes, etc.

  (Hmm, template/aix contains this: CFLAGS='-qchars=signed ...'. That can't
  be good.)
 
 Probably Andreas put that in --- maybe he still remembers why.  But it
 shouldn't matter.  We need to be able to run on platforms where char is
 signed and there's no handy "-funsigned-chars" compiler option.

What I meant was that

(a) according to Oleg's report, the source depends on char being unsigned
in some places, so those places break on AIX, and

(b) according to the above, the source apparently requires char to be
signed in some places, so it breaks when char is made unsigned.

*That* can't be good.


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




[HACKERS] WAL MVCC

2000-09-18 Thread devik

Hi,
I'm just curious how MVCC will work witk WAL ? Will
it work in the same fashion as now only tuples written
using WAL ?
Or will it search for old tuple's versions in log ?

thanks devik



Re: [HACKERS] Cannot compile

2000-09-18 Thread Michael Meskes

On Sun, Sep 17, 2000 at 12:29:16PM +0200, Peter Eisentraut wrote:
 It might be that `make depend' is broken in one way or another. What you
 want to do is rm `find . -name depend` and then ./configure
 --enable-depend. Or you could try to rerun make depend then. I have a
 feeling what is causing this but it's too weird to explain but I'll try to
 look at it. ;-)

That was the solution. It's compiling right now. I never tried this because
I thought make distclean would remove the depend files as well.

Anyway thanks a lot.

Michael
-- 
Michael Meskes
[EMAIL PROTECTED]
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!



[HACKERS] Re: pg_dump tries to do too much per query

2000-09-18 Thread Philip Warner

At 16:29 17/09/00 -0400, Tom Lane wrote:

create table test (f1 int);
create view v_test as select f1+1 as f11 from test;
drop table test;

then run pg_dump:

getTables(): SELECT failed.  Explanation from backend: 'ERROR:  cache
lookup of attribute 1 in relation 400384 failed
'.


FWIW, the patch below causes get_viewdef to produce:

ERROR:  pg_get_viewdef: cache lookup of attribute 1 in relation 19136
failed for rule v_test

when a table has been deleted.


--- ruleutils.c.origWed Sep 13 22:08:04 2000
+++ ruleutils.c Mon Sep 18 20:59:25 2000
@@ -72,6 +72,7 @@
  * --
  */
 static char *rulename = NULL;
+static char *toproutinename = NULL;
 static void *plan_getrule = NULL;
 static char *query_getrule = "SELECT * FROM pg_rewrite WHERE rulename = $1";
 static void *plan_getview = NULL;
@@ -134,6 +135,12 @@
int len;
 
/* --
+* We use this in reporting errors.
+* --
+*/
+   toproutinename = "pg_get_ruledef";
+
+   /* --
 * We need the rules name somewhere deep down: rulename is global
 * --
 */
@@ -234,6 +241,12 @@
char   *name;
 
/* --
+* We use this in reporting errors.
+* --
+*/
+   toproutinename = "pg_get_viewdef";
+
+   /* --
 * We need the view name somewhere deep down
 * --
 */
@@ -337,6 +350,13 @@
char   *sep;
 
/* --
+* We use this in reporting errors.
+* --
+*/
+   toproutinename = "pg_get_indexdef";
+   rulename = NULL;
+
+   /* --
 * Connect to SPI manager
 * --
 */
@@ -554,6 +574,13 @@
Form_pg_shadow user_rec;
 
/* --
+* We use this in reporting errors.
+* --
+*/
+   toproutinename = "pg_get_userbyid";
+   rulename = NULL;
+
+   /* --
 * Allocate space for the result
 * --
 */
@@ -2014,8 +2041,16 @@
 
ObjectIdGetDatum(relid), (Datum) attnum,
 0, 0);
if (!HeapTupleIsValid(atttup))
-   elog(ERROR, "cache lookup of attribute %d in relation %u failed",
-attnum, relid);
+   {
+   if (rulename != NULL)
+   {
+   elog(ERROR, "%s: cache lookup of attribute %d in relation %u 
+failed for
rule %s",
+   toproutinename, attnum, relid, rulename);
+   } else {
+   elog(ERROR, "%s: cache lookup of attribute %d in relation %u 
+failed",
+   toproutinename, attnum, relid);
+   }
+   }
 
attStruct = (Form_pg_attribute) GETSTRUCT(atttup);
return pstrdup(NameStr(attStruct-attname));


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] ascii to character conversion in postgres

2000-09-18 Thread The Hermit Hacker

On Mon, 18 Sep 2000, Tom Lane wrote:

 Karel Zak [EMAIL PROTECTED] writes:
   Not documented (from oracle_compat.c) in PG documentation:
  btrim()
  ascii()
  ichar()
  repeat()
   and about ichar() is nothing in Oracle documentation, it's knows chr() 
  only...
 
 Sounds to me like calling it ichar() was an error, then.  Should be chr().
 
  Directly rename it, or add "alias" entry to the pg_proc? 
 
 The alias would only be useful to people who had been using it as
 "ichar()" --- which is not many people, since it's undocumented ;-)
 Furthermore, now that I look, it looks like ichar() was new in
 contrib/odbc in 7.0 and has only recently been moved into the main
 code.
 
 I vote for just renaming it to chr().  Any objections?

first thing off the top of my head ... was there a reason why it was added
to contrib/odbc?  ignoring the "oracle documentation", is it something
that is/was needed for ODBC?

Marc G. Fournier   ICQ#7615664   IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: [EMAIL PROTECTED]   secondary: scrappy@{freebsd|postgresql}.org 




RE: [HACKERS] WAL MVCC

2000-09-18 Thread Mikheev, Vadim

 Hi,
 I'm just curious how MVCC will work witk WAL ? Will
 it work in the same fashion as now only tuples written
 using WAL ?

Yes.

 Or will it search for old tuple's versions in log ?

SMGR is strill non-overwriting one.

Vadim



Re: [HACKERS] Notice and share memory corruption

2000-09-18 Thread Tom Lane

Hannu Krosing [EMAIL PROTECTED] writes:
 Define your terms more carefully, please.  What do you mean by
 "unable to vacuum" --- what happens *exactly*? 

 NOTICE:  FlushRelationBuffers(access_right, 2009): block 1944 is
 referenced (private 0, global 2)
 FATAL 1:  VACUUM (vc_repair_frag): FlushRelationBuffers returned -2

Oh, that's interesting.  This error indicates that some prior
transaction neglected to release a reference count on a shared buffer.
We have seen sporadic reports of this problem in 7.0, but so far no
one has come up with a reproducible example.  If you can boil down
your script to something that reproducibly causes the problem then
that'd be a great help in tracking it down.

If you have clients that sometimes disconnect in the middle of a
transaction, it might help to apply the attached patch.

 Maybe i have to really restart it (instead of doing
 /etc/rc.d/init.d/postgresql restart)
 by running killall -9  /usr/bin/postgres

Restarting the postmaster should clear the problem (by releasing and
reinitializing shared memory).  I dunno where you got the idea that
kill -9 was a recommended way of shutting down the system, but I sure
wouldn't recommend it.  A plain kill on the postmaster ought to do it
(see the pg_ctl script in release 7.0.*).

regards, tom lane

*** src/backend/tcop/postgres.c.origSat May 20 22:23:30 2000
--- src/backend/tcop/postgres.c Wed Aug 30 16:47:51 2000
***
*** 1459,1465 
 * Initialize the deferred trigger manager
 */
if (DeferredTriggerInit() != 0)
!   proc_exit(0);
  
SetProcessingMode(NormalProcessing);
  
--- 1459,1465 
 * Initialize the deferred trigger manager
 */
if (DeferredTriggerInit() != 0)
!   goto normalexit;
  
SetProcessingMode(NormalProcessing);
  
***
*** 1479,1490 
TPRINTF(TRACE_VERBOSE, "AbortCurrentTransaction");
  
AbortCurrentTransaction();
!   InError = false;
if (ExitAfterAbort)
!   {
!   ProcReleaseLocks(); /* Just to be sure... */
!   proc_exit(0);
!   }
}
  
Warn_restart_ready = true;  /* we can now handle elog(ERROR) */
--- 1479,1489 
TPRINTF(TRACE_VERBOSE, "AbortCurrentTransaction");
  
AbortCurrentTransaction();
! 
if (ExitAfterAbort)
!   goto errorexit;
! 
!   InError = false;
}
  
Warn_restart_ready = true;  /* we can now handle elog(ERROR) */
***
*** 1553,1560 
if (HandleFunctionRequest() == EOF)
{
/* lost frontend connection during F message 
input */
!   pq_close();
!   proc_exit(0);
}
break;
  
--- 1552,1558 
if (HandleFunctionRequest() == EOF)
{
/* lost frontend connection during F message 
input */
!   goto normalexit;
}
break;
  
***
*** 1608,1618 
 */
case 'X':
case EOF:
!   if (!IsUnderPostmaster)
!   ShutdownXLOG();
!   pq_close();
!   proc_exit(0);
!   break;
  
default:
elog(ERROR, "unknown frontend message was received");
--- 1606,1612 
 */
case 'X':
case EOF:
!   goto normalexit;
  
default:
elog(ERROR, "unknown frontend message was received");
***
*** 1642,1651 
if (IsUnderPostmaster)
NullCommand(Remote);
}
!   }   /* infinite for-loop */
  
!   proc_exit(0);   /* shouldn't get here... */
!   return 1;
  }
  
  #ifndef HAVE_GETRUSAGE
--- 1636,1655 
if (IsUnderPostmaster)
NullCommand(Remote);
}
!   }   /* end of main loop */
! 
! normalexit:
!   ExitAfterAbort = true;  /* ensure we will exit if elog during abort */
!   AbortOutOfAnyTransaction();
!   if (!IsUnderPostmaster)
!