Re: [SQL] ./configure problems

2000-11-09 Thread Jerome Alet

On 8 Nov 2000 [EMAIL PROTECTED] wrote:

> I did this to install postgres in a new machine:
> ./configure --prefix=/usr/local/pgsql --with-tcl --with-perl
> 
> and I got this:
> loading cache ./config.cache
> checking host system type... /usr/src/pgsql/postgresql-7.0.2/src/config.guess:
> 13497442: No space left on device
> /usr/src/pggsql/postgresql-4.0.2/sr/config.guess: 135012768: No space left on
> device
> configure: error: can not guess host type: you must specify one
> 
> I have 8GB in the /usr directory
> Do somebody know whats going on?

When you run configure, configure itself runs lots of commands,
program compilations and etc... in order to test your environment. 

It's highly probable that one of these commands need free space in /tmp as
well as in /usr/src/pgsql/postgresql-7.0.2/src/

IMHO you should check for free space in /tmp

good luck.

Jerome Alet




Re: [SQL] insert value of form - checkboxes

2000-11-09 Thread Antti Linno



On Thu, 9 Nov 2000, Astrid Hexsel wrote:

> Hello all,
> 
>  I have a form which has got checkboxes and I am having problems  to have their
> values stored in different rows of a table.
> 
> 
> What I have done is: 
> 
> # colour_id is the name of my checkboxes in the input tag
> 
>  
> etc ...
> 
> # I put all the values into the array and split them
> 
> $colour = $formdata{'colour_id'};
> @colours = split (/,/, $colour);

Try to print the array out, to check whether all values are there.

> 
> #then I want to insert then into a table (called cart)in the row called colour_id.
> If I have more than one value they have to be in different rows.
> 
> # my code:
> 
>   foreach $colour(@colours)
> {
>$qry = INSERT INTO cart VALUES 
>   ('$session_id', '$range_id', '$colour')
> }
> 

Try to specify what are you inserting, and use double quotes:

foreach $colour (@colours) {

$qry = qq{ 
INSERT INTO cart (session_id,range_id,colour) VALUES
('$session_id','$range_id','$colour')
};

$dbh->do(qq{ $qry });# how about this?

}


Btw, try print out in the loop to see, if you are getting right inserts.

> And what happens is that I am only getting just
> one value now inserted in the row. If for example I checked 3 boxes I will get
> only the last
> one.
> 
> The foreach loop works fine out of the query.
> 
> Thanks a lot for any help.

Advice, don't take my CGI as pure gold. I use Embperl, and so my cgi may
be not so error-free :)

Greetings,
Antti





[SQL] how to write it in most efficient way?

2000-11-09 Thread hubert depesz lubaczewski

hi. i have database with two tables like this:
database=> \d groups
   Table "groups"
 Attribute |  Type   |   Modifier   
---+-+--
 id| integer | not null default nextval('groups_seq'::text)
 parent_id | integer | not null default 0
 image_id  | integer | not null default 0
 name  | text| not null default ''

database=> \d g_order 
   Table "g_order"
 Attribute |  Type   |   Modifier
---+-+---
 id| integer | not null default nextval('g_order_seq'::text)
 group_id  | integer | not null default 0

data inside are (for test purposes):
database=> select * from groups;
 id | parent_id | image_id | name 
+---+--+--
  0 | 0 |0 | 
  1 | 0 |0 | RTV
  2 | 0 |0 | AGD
  3 | 0 |0 | MP3
  4 | 1 |0 | Audio
  5 | 2 |0 | Lodwki
  6 | 2 |0 | Kuchenki Mikrofalowe
  7 | 4 |0 | Sony
  8 | 4 |0 | Panasonic
(9 rows)
database=> select * from g_order;
 id | group_id 
+--
  1 |2
  2 |6
  3 |5
  4 |3
  5 |1
  6 |4
  7 |8
  8 |7
(8 rows)

the table g_order allows me to change order of displaying groups without changing
main groups table. just like this:
database=> select g.id, getgrouppath(g.id,'/') from groups g, g_order o where
g.id = o.group_id order by o.id;
 id |   getgrouppath   
+--
  2 | AGD
  6 | AGD/Kuchenki Mikrofalowe
  5 | AGD/Lodwki
  3 | MP3
  1 | RTV
  4 | RTV/Audio
  8 | RTV/Audio/Panasonic
  7 | RTV/Audio/Sony
(8 rows)
 
o.k. and now comes my problem:
i need to know which group (groups.id) is first (after ordering) subgroup of
group ... for example 4 (rtv/audio).
i'm doing it now with:
SELECT
  go.group_id
FROM
  g_order go
WHERE
  go.id = (
SELECT
  min(o.id)
FROM
  groups g,
  g_order o
WHERE
  g.id = o.group_id and
  g.parent_id=4 and
  g.id <> 0
  )
;

but i feel that there should be a better/faster way to do it.
my tables have primary keys, foreign key (groups.id <=> g_order.group_id),
indices.

any idea how to write a better select to do what i need? or maybe the one i
wrote is the best one?

depesz

-- 
hubert depesz lubaczewski

 najwspanialszą rzeczą jaką dało nam nowoczesne społeczeństwo,
  jest niesamowita wręcz łatwość unikania kontaktów z nim ...



[SQL] shared memory blocks?

2000-11-09 Thread rocael

Hi,
how can I  configure my kernel to make it work with shared memory blocks of
8Mb?
I'm using RedHat 6.2

Thank you for your help!
Rocael.

Tom Lane <[EMAIL PROTECTED]> wrote:
<[EMAIL PROTECTED]> writes:
> /usr/local/pgsql/bin/postmaster -B 1000 -o "-S 2000" -S -D
> /usr/local/pgsql/data

> and it says:
> IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
> size=8899584,permission=600
> This type of erro is usually caused by an improper shared memory or System
V
> IPC semaphore configuration. Form more information

Most likely your kernel isn't set to allow shared memory blocks as
large as 8M.

regards, tom lane



Get free email and a permanent address at http://www.netaddress.com/?N=1



Re: [SQL] alter table add column implementation undesirable?

2000-11-09 Thread Tom Lane

Forest Wilkinson <[EMAIL PROTECTED]> writes:
> A coworker told me that the postgres implementation of ALTER TABLE ADD
> COLUMN creates an inefficient database.

Dunno where he got that idea.

There are some problems lurking in ADD COLUMN when used on a table with
inheritance children --- the new column is added to the children too, as
it should be, but in an unexpected column position, which causes trouble
for pg_dump (a dump and reload will do the wrong thing).  Perhaps what
you heard is a garbled report of that issue.

regards, tom lane



Re: [SQL] shared memory blocks?

2000-11-09 Thread Poul L. Christiansen

This line will set the maximum shared memory in Linux to 64MB:
echo 67108864 > /proc/sys/kernel/shmmax

You can see your default maximum shared memory with this command:
cat /proc/sys/kernel/shmmax

You should probably set this line in /etc/rd.d/init.d/postgresql or
somewhere else, before PostgreSQL starts because the change will be set
back to the default value when Linux restarts.

Poul L. Christiansen

[EMAIL PROTECTED] wrote:
> 
> Hi,
> how can I  configure my kernel to make it work with shared memory blocks of
> 8Mb?
> I'm using RedHat 6.2
> 
> Thank you for your help!
> Rocael.
> 
> Tom Lane <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> writes:
> > /usr/local/pgsql/bin/postmaster -B 1000 -o "-S 2000" -S -D
> > /usr/local/pgsql/data
> 
> > and it says:
> > IpcMemoryCreate: shmget failed (Invalid argument) key=5432001,
> > size=8899584,permission=600
> > This type of erro is usually caused by an improper shared memory or System
> V
> > IPC semaphore configuration. Form more information
> 
> Most likely your kernel isn't set to allow shared memory blocks as
> large as 8M.
> 
> regards, tom lane
> 
> 
> Get free email and a permanent address at http://www.netaddress.com/?N=1



[SQL] [sql]Joins

2000-11-09 Thread Najm Hashmi

I am facing a dilemma at my work,   I am using postgres first time. For
some reason, my co-workers think that in Postgres joins i.e.
simple joins of two or three tables are so bad that their cost is
exponential. They believe that postgres simply takes  Cartesian product
of joining table in order to obtain desired tuples i.e. no optimization
is done.
   I refused to believe  so. I need your help to convince
them that it is okay to join tables --two or three tables :)-- so we can

eliminate redundancies from the database. I also want to know how
postgres optimizes a join query.  Thank you very much your help.
Regards
Najm




Re: [SQL] [sql]Joins

2000-11-09 Thread Stephan Szabo


On Fri, 10 Nov 2000, Najm Hashmi wrote:

> I am facing a dilemma at my work,   I am using postgres first time. For
> some reason, my co-workers think that in Postgres joins i.e.
> simple joins of two or three tables are so bad that their cost is
> exponential. They believe that postgres simply takes  Cartesian product
> of joining table in order to obtain desired tuples i.e. no optimization
> is done.
>I refused to believe  so. I need your help to convince
> them that it is okay to join tables --two or three tables :)-- so we can 
> eliminate redundancies from the database. I also want to know how
> postgres optimizes a join query.  Thank you very much your help.

Umm, I don't know where they got that idea.  Tom Lane can go into details 
as the optimizer guru, but as a start, if you use EXPLAIN on your queries,
the system will tell you what plan it would use if you were to run the
query.  That will get you some idea of what the system is doing.

I've had no problems really until about 8-12 tables joined when you might
tickle a bug in some versions of postgres which cause bogus plans to be
generated.




Re: [SQL] Oracle, ODBC, MS IIS -> problem!

2000-11-09 Thread Josh Berkus

Mr. Steinbach,

> I have to create a web interface for an Oracle database. I use MS Internet
> Information Server, ODBC driver (tried one from MS and one from Oracle) and an
> Oracle database (I have no permission to change anything in that database).


You seem to have joined/posted to our mailing list in error.  This is a
PostgreSQL SQL-developers mailing list.  If you need help with Oracle, I
suggest proceeding to www.oracle.com and looking for appropriate forums;
I'm sure there are many.

-Josh Berkus

-- 
__AGLIO DATABASE SOLUTIONS___
Josh Berkus
   Complete information technology  [EMAIL PROTECTED]
and data management solutions   (415) 436-9166
   for law firms, small businesses   fax  436-0137
and non-profit organizations.   pager 338-4078
San Francisco



[SQL] Requests for Development

2000-11-09 Thread Josh Berkus

Tom, Bruce, Jan, etc.:

As a PGSQL developer and business customer, I wanted to make some
public requests as to the development path of PGSQL.  While, obviously,
you will develop the functionality *you* are interested in, I thought it
might be valuable to you to know what things would be most appreciated
(and please, list folks, speak up).

1. Please finish 7.1, stabilize it, and release it.  I am probably not
the only developer with an application that is waiting for the many
wonderful improvements Tom has added to 7.1, but I can't build a
commercial app off the CVS source tree.

The rest of these requests apply to 7.2:

2. Stored Procedure functionality, i.e. outputting a full recordset from
a function (or new structure, if functions are hard to adapt) based on
the last SELECT statement passed to the function.  An alternative would
be to develop parameterized views, which might be the easiest path.

3. Slightly more informative syntax error messages - frankly, just
grabbing a little more text around the word or punctuation that
triggered the error would be enormously helpful (I can't tell you the
number of times I've gotten "Error at or near ')'" in a huge DDL
statement.

4. Use of named in addition to ordinal variables in PL/PGSQL functions
(e.g. $account_type, $period instead of $1, $2).

Thanks so much for your ongoing hard work!

-Josh Berkus
-- 
__AGLIO DATABASE SOLUTIONS___
Josh Berkus
   Complete information technology  [EMAIL PROTECTED]
and data management solutions   (415) 436-9166
   for law firms, small businesses   fax  436-0137
and non-profit organizations.   pager 338-4078
San Francisco



Re: [SQL] [sql]Joins

2000-11-09 Thread Cristóvão B. B. Dalla Costa

> I've had no problems really until about 8-12 tables joined when you might
> tickle a bug in some versions of postgres which cause bogus plans to be
> generated.

I've had queries with over 25 joins and self-joins with no problems
whatsoever.





Re: [SQL] Requests for Development

2000-11-09 Thread Roberto Mello

Josh Berkus wrote:
> 
> Tom, Bruce, Jan, etc.:
> 
> As a PGSQL developer and business customer, I wanted to make some
> public requests as to the development path of PGSQL.  While, obviously,
> you will develop the functionality *you* are interested in, I thought it
> might be valuable to you to know what things would be most appreciated
> (and please, list folks, speak up).

I second all Josh's requests and I could add:

- Procedures instead of just functions on PL/PgSQL (and maybe PL/Tcl).
- Default values for PL/PgSQL functions/procedures.

Thanks for the great work PG team.

-Roberto
-- 
Computer ScienceUtah State University
Space Dynamics Laboratory   Web Developer
USU Free Software & GNU/Linux Club  http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto



[SQL] Re: Requests for Development

2000-11-09 Thread Andreas Tille

On Thu, 9 Nov 2000, Josh Berkus wrote:

> 2. Stored Procedure functionality, i.e. outputting a full recordset from
> a function (or new structure, if functions are hard to adapt) based on
> the last SELECT statement passed to the function.  An alternative would
> be to develop parameterized views, which might be the easiest path.
I'm not really sure if parameterized views are a real alternative.
They would help in some cases, but *real* stored procedures would be
much more powerful.  In my opinion it is also in the sense of easier
porting from databases to PostgreSQL to the benefit od PostgreSQL.

I wonder if there couldn't borrowed some code from Interbase which has
full featured stored procedures - at least it was told to me that it has ...
 
> 3. Slightly more informative syntax error messages - frankly, just
> grabbing a little more text around the word or punctuation that
> triggered the error would be enormously helpful (I can't tell you the
> number of times I've gotten "Error at or near ')'" in a huge DDL
> statement.
Waht about i18n.  Could PostgreSQL sources gettext-ized?
 
>   Thanks so much for your ongoing hard work!
Couldn'trepeated often enough alos for the past!

Kind regards

Andreas.




[SQL] alter table add column implementation undesirable?

2000-11-09 Thread Forest Wilkinson

A coworker told me that the postgres implementation of ALTER TABLE ADD
COLUMN creates an inefficient database.  He said it results in a table
whose new column is stored someplace other than the rest of the columns.
(A hidden auxiliary table?)  Is this true in postgres 6.5.3?  7.x?  Was it
ever true?

Forest Wilkinson