[BUGS] ECPG does not correctly identify pointer type

2001-08-14 Thread pgsql-bugs

Lee Kindness ([EMAIL PROTECTED]) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
ECPG does not correctly identify pointer type

Long Description
The embedded SQL preprocessor, ecpg, does not correctly identify pointer types. 
Example #1 below results in the output #2 (edited for clarity) which incorrectly has 
references to 'ptr.id' and 'ptr.name' rather than 'ptr->id' and 'ptr->name' 
respectively.

When the 'ExamplePtr ptr' definition is replaced by 'ExampleStr *ptr' the same output 
is produced, when changed to 'struct ExampleStr_ *ptr' ecpg outputs the error:

test.pc:16: ERROR: parse error

I am running ecpg version 2.7.1 on a Redhat Linux 7.0 system.

Sample Code
#1:

typedef struct ExampleStr_
{
  int  id;
  char name[100];
} ExampleStr, *ExamplePtr;

EXEC SQL TYPE ExampleStr IS STRUCT
{
  int  id;
  char name[100];
};
EXEC SQL TYPE ExamplePtr IS ExampleStr REFERENCE;

ExamplePtr getExample(int id)
{
  EXEC SQL BEGIN DECLARE SECTION;
  ExamplePtr ptr;
  int s_id = id;
  EXEC SQL END DECLARE SECTION;

  if( (ptr = calloc(1, sizeof(ExampleStr))) != NULL )
{
  EXEC SQL SELECT *
INTO :ptr
FROM example
WHERE id = :s_id;
}
  return( ptr );
}

#2:

/* Processed by ecpg (2.7.1) */
/* These three include files are added by the preprocessor */
#include 
#include 
#include 

typedef struct ExampleStr_
{
  int  id;
  char name[100];
} ExampleStr, *ExamplePtr;

/* exec sql type ExampleStr is struct  { 
   int  id   ;
   char  name [ 100 ]   ;
 }   */
/* exec sql type ExamplePtr is ExampleStr  reference */

ExamplePtr getExample(int id)
{
  /* exec sql begin declare section */
   ExamplePtr  ptr   ;
   int  s_id  = id ;
  /* exec sql end declare section */

  if( (ptr = calloc(1, sizeof(ExampleStr))) != NULL )
{
{ ECPGdo(__LINE__, NULL, "select  *  from example  where id  = ? ", 
ECPGt_int,&(s_id),1L,1L,sizeof(int), 
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, 
ECPGt_int,&(ptr.id),1L,1L,sizeof(int), 
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
ECPGt_char,(ptr.name),100L,1L,100*sizeof(char), 
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
}
  return( ptr );
}

No file was uploaded with this report


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



[BUGS] triggers

2001-08-14 Thread Martin Kuria

Hi, I have a problem I am using postgresql database and I want to enforce
   >triggers between my related tables ( tables with relationship), one 
table
   >has a foreign key and the other the a primary key, I would like to use
   >triggers to update, delete, and insert in this tables but the table with 
the
   >foreign key should first check in the other table before any action is
   >taken, Which is the simplest sql or C language script can I use to 
enforce
   >triggers within my tables, please demonstrate a simple scenerio thanks

Martin Wainaina Kuria
Programmer/Database Administrator
Bsc. Computer Science
Kenyaweb.com Ltd
www.kenyaweb.com


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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



[BUGS] -ltermcap needed for psql client build on OpenBSD 2.9

2001-08-14 Thread Tom Stowell

Doing a default ./configure (no additional options) on a freshly installed OpenBSD 2.9 
results in a 'psql' binary that isn't linked to termcap.  The error looks like this:

$ ./psql
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help on internal slash commands
   \g or terminate with semicolon to execute query
   \q to quit

/usr/libexec/ld.so: Undefined symbol "_tgetent" called from psql:/usr/lib/librea
dline.so.0.0 at 0x40088964
$

-snip-

"_tgetent" is a termcap symbol, and simply appending

-ltermcap

...to the final gcc command during the 'psql' make fixes the problem.  This should 
probably work w/o human intervention, however.  :-)


PostgreSQL rocks!


Tom Stowell






---(end of broadcast)---
TIP 3: 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] WAL couse die my database?

2001-08-14 Thread root

Hellow.
Unfortunaly for me postgresql 7.1.2 builds by default with WAL (and there were'n 
configure options to turn it of). So one of files in $database/xlog was corrupted. 
Postgres is not starting cose of corrupted WAL files:
===
DEBUG:  database system was shut down at 2001-08-13 18:38:03 MSD
DEBUG:  ReadRecord: record with zero len at (0, 888385420)
DEBUG:  Invalid primary checkPoint record
DEBUG:  ReadRecord: record with zero len at (0, 888385356)
DEBUG:  Invalid secondary checkPoint record
FATAL 2:  Unable to locate a valid CheckPoint record
===

So how to save my bases and repare WAL files?

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

http://www.postgresql.org/search.mpl



[BUGS] Impossible to bind to a specific IP address

2001-08-14 Thread Graham Leggett

Hi,

As far as I can tell from the documentaion, it is impossible to tell the
postmaster daemon to bind to just a single IP address - only to a
specific port on all IP addresses. This makes hardening the box
postgresql is running on impossible.

Is there a workaround to this? (other than trying to firewall off the
ports - the box needs to be protected from other boxes nearby - it is in
an insecure environment).

Regards,
Graham
-- 
-
[EMAIL PROTECTED]"There's a moon
over Bourbon Street
tonight..."
 S/MIME Cryptographic Signature


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



[BUGS] BUG!!! or not?

2001-08-14 Thread halturin

Hello pgsql-bugs,
  my name is Taras (from Russia). sorry for my bad English.

  i have set the password access to connecting to the database.
  hash passwords stored in the '/usr/local/pgsql/data/pg_shadow' file.
  for example, username is 'lanta' and password is 'asdfghjk'
  When i'm connecting i need to enter only password (because user
  name = user login name, i'm right? ), so...

servak:/usr/local/pgsql/bin# ./psql -h 192.168.1.1 homebase
Password:  <-- entering password 'asdfghjk'
  
  8 - chars


connect is OK...

"where the BUG?"

servak:/usr/local/pgsql/bin# ./psql -h 192.168.1.1 homebase
Password:  <-- entering password 'asdfghjkpmqwoeim10234'
  ^
  i have added to the password
  any char's and ...
connect is OK...

as far as i understand, you have reserved only 8 chars for the password
or i have found BUG?

-- 
Best regards,
 halturin  mailto:[EMAIL PROTECTED]



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



[BUGS] Except all bug in PostgreSQL 7.1*

2001-08-14 Thread Szinyei Gerzson

Hi,

I have found a bug in PostgreSQL doing "except all". Some records are
removed from the result, even though they should stay. Except all removed
records which were _not_ in the table that were excepted from the original
table.

I have put the data and small python code here:

http://www.webit.hu/~gerzson/pgexceptbugtest.tgz

Thank you in advance,

Gerzson Szinyei


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



[BUGS] Except all bug in PostgreSQL 7.1*

2001-08-14 Thread Szinyei Gerzson

Hi,

I have found a bug in PostgreSQL doing "except all".
It removes some records which it shouldnt when I run except on large data
sets. If I run the same except only on the records in question (using
where...), it shows up in the result ok.

I have put the data and small python code here:

http://www.webit.hu/~gerzson/pgexceptbugtest.tgz

Thank you in advance,

Gerzson Szinyei



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

http://www.postgresql.org/search.mpl



Re: [BUGS] WAL couse die my database?

2001-08-14 Thread Tom Lane

root <[EMAIL PROTECTED]> writes:
> Unfortunaly for me postgresql 7.1.2 builds by default with WAL (and
> there were'n configure options to turn it of). So one of files in
> $database/xlog was corrupted.

Do you know what happened to it?  Is there a bug we need to fix here?

> So how to save my bases and repare WAL files?

See contrib/pg_resetxlog.

regards, tom lane

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

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [BUGS] Except all eliminates what it shouldnt

2001-08-14 Thread Tom Lane

[EMAIL PROTECTED] writes:
> Except all eliminates what it shouldnt

Hmm, nasty.  It looks like all nested cases of INTERSECT/EXCEPT are
broken.

Attached is a patch I've applied to CVS sources (7.2-to-be).  I don't
have enough confidence in it to back-patch it into 7.1.* right now,
but if you want to apply it locally I think it will work for you.

regards, tom lane


*** src/backend/optimizer/prep/prepunion.c.orig Tue Jun  5 01:26:04 2001
--- src/backend/optimizer/prep/prepunion.c  Tue Aug 14 12:55:33 2001
***
*** 275,286 
 *
 * The tlist for an Append plan isn't important as far as the Append is
 * concerned, but we must make it look real anyway for the benefit of
!* the next plan level up.
 */
plan = (Plan *)
make_append(makeList2(lplan, rplan),
false,
!   generate_setop_tlist(op->colTypes, 0, false,
 
lplan->targetlist,
 
refnames_tlist));
  
--- 275,288 
 *
 * The tlist for an Append plan isn't important as far as the Append is
 * concerned, but we must make it look real anyway for the benefit of
!* the next plan level up.  In fact, it has to be real enough that the
!* flag column is shown as a variable not a constant, else setrefs.c
!* will get confused.
 */
plan = (Plan *)
make_append(makeList2(lplan, rplan),
false,
!   generate_setop_tlist(op->colTypes, 2, false,
 
lplan->targetlist,
 
refnames_tlist));
  
***
*** 353,358 
--- 355,367 
  
  /*
   * Generate targetlist for a set-operation plan node
+  *
+  * colTypes: column datatypes for non-junk columns
+  * flag: -1 if no flag column needed, 0 or 1 to create a const flag column,
+  *   2 to create a variable flag column
+  * hack_constants: true to copy up constants (see comments in code)
+  * input_tlist: targetlist of this node's input node
+  * refnames_tlist: targetlist to take column names from
   */
  static List *
  generate_setop_tlist(List *colTypes, int flag,
***
*** 414,432 
  
if (flag >= 0)
{
!   /* Add a resjunk column yielding specified flag value */
resdom = makeResdom((AttrNumber) resno++,
INT4OID,
-1,
pstrdup("flag"),
true);
!   expr = (Node *) makeConst(INT4OID,
! sizeof(int4),
! Int32GetDatum(flag),
! false,
! true,
! false,
! false);
tlist = lappend(tlist, makeTargetEntry(resdom, expr));
}
  
--- 423,454 
  
if (flag >= 0)
{
!   /* Add a resjunk flag column */
resdom = makeResdom((AttrNumber) resno++,
INT4OID,
-1,
pstrdup("flag"),
true);
!   if (flag <= 1)
!   {
!   /* flag value is the given constant */
!   expr = (Node *) makeConst(INT4OID,
! sizeof(int4),
! 
Int32GetDatum(flag),
! false,
! true,
! false,
! false);
!   }
!   else
!   {
!   /* flag value is being copied up from subplan */
!   expr = (Node *) makeVar(0,
!   resdom->resno,
!   

Re: [BUGS] -ltermcap needed for psql client build on OpenBSD 2.9

2001-08-14 Thread Tom Lane

"Tom Stowell" <[EMAIL PROTECTED]> writes:
> "_tgetent" is a termcap symbol, and simply appending
> -ltermcap
> ...to the final gcc command during the 'psql' make fixes the problem.
> This should probably work w/o human intervention, however.  :-)

Indeed.  The configure script should have deduced the need to do this;
could you look into why it fails to do so on your platform?

regards, tom lane

---(end of broadcast)---
TIP 3: 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] BUG!!! or not?

2001-08-14 Thread Tom Lane

halturin <[EMAIL PROTECTED]> writes:
> Password:  <-- entering password 'asdfghjkpmqwoeim10234'
>   ^
>   i have added to the password
>   any char's and ...
> connect is OK...

Blame Unix crypt().  It discards characters beyond the 8th on many
platforms.  If you try setting an 8-or-more-character password on
your shell account, you'll probably find it behaves the same way.

regards, tom lane

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



Re: [BUGS] Impossible to bind to a specific IP address

2001-08-14 Thread Tom Lane

Graham Leggett <[EMAIL PROTECTED]> writes:
> As far as I can tell from the documentaion, it is impossible to tell the
> postmaster daemon to bind to just a single IP address

Sure you can, assuming you're running a current release.  See
VIRTUAL_HOST config parameter or equivalent -h commandline switch.

regards, tom lane

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



Re: [BUGS] Impossible to bind to a specific IP address

2001-08-14 Thread Bruce Momjian

> Hi,
> 
> As far as I can tell from the documentaion, it is impossible to tell the
> postmaster daemon to bind to just a single IP address - only to a
> specific port on all IP addresses. This makes hardening the box
> postgresql is running on impossible.
> 
> Is there a workaround to this? (other than trying to firewall off the
> ports - the box needs to be protected from other boxes nearby - it is in
> an insecure environment).

In 7.1.X you can bind to a specific IP.  See postmaster -h flag.  Not
sure about 7.0.X releases.

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

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

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [BUGS] -ltermcap needed for psql client build on OpenBSD 2.9

2001-08-14 Thread Peter Eisentraut

Tom Stowell writes:

> "_tgetent" is a termcap symbol, and simply appending
>
> -ltermcap
>
> ...to the final gcc command during the 'psql' make fixes the problem.  This should 
>probably work w/o human intervention, however.  :-)

We have disqualified this as a linker bug pending OS developer feedback.
See NetBSD PR 13486:

http://www.NetBSD.org/cgi-bin/query-pr-single.pl?number=13486

No reponses yet.  Feel free to post this to an OpenBSD forum.

-- 
Peter Eisentraut   [EMAIL PROTECTED]   http://funkturm.homeip.net/~peter


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



[BUGS] JDBC driver converts search string patterns to lowercase

2001-08-14 Thread pgsql-bugs

Bjorn Peterson ([EMAIL PROTECTED]) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
JDBC driver converts search string patterns to lowercase

Long Description
The metadata class of the Postgresql 7.1 JDBC driver converts search string patterns 
to all lowercase.  This means that if I want to use 
metadata.getColumns(null,null,tableName,"%") for example, the tableName will be 
converted to all lowercase, and will not match if my table names have any capital 
letters.  I tried quoting the table names, but that didn't work either.  I see no 
reason for the names to be converted to lower case, and it is extremely inconvenient 
to code a work-around for this.

Sample Code


No file was uploaded with this report


---(end of broadcast)---
TIP 3: 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