Re: [SQL] Re: [GENERAL] Getting the result of a query using COUNT(*)

2000-08-28 Thread Alexandru COSTIN

Hello
Try this way:
 SELECT COUNT(*) as no FROM MyTable
 rs.getint("no");
Or
 SELECT COUNT(*) FROM MyTable
rs.getInt(0); (or (1))
alexander


> Jackson Ching wrote:
> >
> > Hi,
> >
> > I'm using JSDK 2.0 and IBM JDK 1.3 on RedHat Linux 6.2
> >
> > As i test my servlet,  I got errors saying count(*) column not
found in a query like this
> >
> > SELECT COUNT(*) FROM MyTable
> >
> > in my rs.getint("COUNT(*)");   in oracle it works fine, in
postgresql it doesn't. how should i handle aggregate functions in SQL then?
> >
> > Thanks
> >
> > Jackson
>
> What version of rostgres do you use?
> SELECT COUNT(*) FROM MyTable works pretty well in postgres 6.5.1 and
> later.
> Perhaps problem is in java?
>
> --
> Sincerely yours,
> Yury





Re: [SQL] Regular expression query

2000-08-28 Thread Oliver Seidel

> The regexp package we currently use implements POSIX 1003.2 regexps
> (see src/backend/regex/re_format.7).  I believe there is an item on the
> TODO list about upgrading the regexp parser to something more modern
> ... feel free to hop on that project if it's bugging you ...

I would like to recommend

ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/ 

which stands for "PERL compatible regular expressions" and has an
expression analyzer & compiler for more efficient repeated matching.
Since Philip Hazel has only written this package to support his Mail
Transfer Agent (exim), it is optimised for performance.

I hope I have been of help,

Oliver Seidel




[SQL] Tutorial

2000-08-28 Thread Alessandro Valenti

Does someone know a free downloadable tutorial on RDBMS usage for
beginners?

thanks,
Alessandro




[SQL] Argument variables for select

2000-08-28 Thread Andreas Tille

Hello,

I want to use the following construct in a stored function:

Create Function VarSelect ( varchar, varchar )
   returns int
   As '
 Declare num int ;
 
 Begin
   Select Into num Count(*) From $1 Where $2 ;
   return num;
 End ;
   ' language 'plpgsql' ;

Could someone please explain who to type the exact syntax so that
I can ship the table to select from as $1 and the condition to select
what as $2?  Or do I have to concatenate a string with the whole
select statement and how to call this string?  In MS SQL server this
could be done with 
   Exec ( query )

Kind regards

  Andreas.




[SQL] shared memory leak in 7.0.2?

2000-08-28 Thread pierre

All,
  i've been running 7.0.2 for the last month or so, and I've had to reboot my 
redhat linux box twice to clear up a shared memory leak issue. Essentially
with the DB running for about 2weeks with large amounts of usage, eventually
the Os runs out of shared memory and the db crashes and fails to restart. The
only way to get the db back online is to reboot.

  Has anyone seen this? Or does anyone have any suggestions on how to fix it?

BTW. Here is my startup line for the postgres daemon.

su -l postgres -c 'exec /usr/local/pgsql/bin/postmaster -B 384  
-D/usr/local/pgsql/data -i -S -o -F


Pierre



Re: [SQL] Argument variables for select

2000-08-28 Thread Yury Don

Andreas Tille wrote:
> 
> Hello,
> 
> I want to use the following construct in a stored function:
> 
> Create Function VarSelect ( varchar, varchar )
>returns int
>As '
>  Declare num int ;
> 
>  Begin
>Select Into num Count(*) From $1 Where $2 ;
>return num;
>  End ;
>' language 'plpgsql' ;
> 
> Could someone please explain who to type the exact syntax so that
> I can ship the table to select from as $1 and the condition to select
> what as $2?  Or do I have to concatenate a string with the whole
> select statement and how to call this string?  In MS SQL server this
> could be done with
>Exec ( query )
> 
> Kind regards
> 
>   Andreas.

AFAIK it's impossible with plpgsql, but it's possible in pltcl.

-- 
Sincerely yours,
Yury



[SQL] Re: Argument variables for select

2000-08-28 Thread Andreas Tille

On Mon, 28 Aug 2000, Yury Don wrote:

> Andreas Tille wrote:
> > 
> > Create Function VarSelect ( varchar, varchar )
> >returns int
> >As '
> >  Declare num int ;
> > 
> >  Begin
> >Select Into num Count(*) From $1 Where $2 ;
> >return num;
> >  End ;
> >' language 'plpgsql' ;
> > 
> AFAIK it's impossible with plpgsql, but it's possible in pltcl.
Hmmm, I wonder how many languages I will learn while dealing with
PostgreSQL.  What about performance of pltcl compared to C.
I wonder if I just do all my work using C-functions, because I
know C very well and don't want to reach the next limit which
I will possibly face when using pltcl.

I would really like to write all my functions in SQL or PLPGSQL.
If this is really impossible (I just wonder if the construct above
could really not be implemented???), I would prefer C over other
languages, if there are no real drawbacks.

Kind regards

 Andreas.




[SQL] Can I get this all in one query?

2000-08-28 Thread Richard Rowell

I'm designing a database/website that will allow students to "grade" the 
professors/classes the students attend.
There are eight different "factors" that the students assign grades on.  Until tonight 
I had one table that kept the
scores assigned by students.  This table name REVIEW had a field named for each 
factor.  IE:

CREATE TABLE review(
class_uid INTEGER   REFERENCES class,
student   VARCHAR(20)   REFERENCES student,
snooze   INTEGER, 
professional INTEGER,
personality   INTEGER,
gradingINTEGER,
effectivenessINTEGER,
knowledge   INTEGER,
accentINTEGER,
enthusiasismINTEGER,

uid SERIAL  PRIMARY KEY,
UNIQUE(class_uid,student)
)

THis allowed me to write simple queries that would pull averages for a 
college,department, a course, a professor,
etc.  Example query:

//Returns averages in all 8 factors of every department
SELECT crs.dept AS department,
   ROUND(AVG(CAST(rvw.snoozeAS FLOAT)) ,2) AS snooze,
   ROUND(AVG(CAST(rvw.professional  AS FLOAT)) ,2) AS professional,
   ROUND(AVG(CAST(rvw.personality   AS FLOAT)) ,2) AS personality,
   ROUND(AVG(CAST(rvw.grading   AS FLOAT)) ,2) AS grading,
   ROUND(AVG(CAST(rvw.effectiveness AS FLOAT)) ,2) AS effectiveness,
   ROUND(AVG(CAST(rvw.knowledge AS FLOAT)) ,2) AS knowledge,
   ROUND(AVG(CAST(rvw.accentAS FLOAT)) ,2) AS accent,
   ROUND(AVG(CAST(rvw.enthusiasism  AS FLOAT)) ,2) AS enthusiasism
  FROM review rvw, class cls, course crs
  WHERE rvw.class_uid=cls.uid AND cls.course_uid=crs.uid
  GROUP BY crs.dept;

However, in a developer meating tonight it was decided that the factors (which are in 
another table in the database)
should not be "hard coded" into the review table, but rather a new table should be 
created implementin the many to
many relationship.  The revised review table(s) looks like so:

CREATE TABLE review
(
  class_uid INTEGER   REFERENCES class,
  student   VARCHAR(30)   REFERENCES student,
  comments  TEXT,

  uid   SERIALPRIMARY KEY,
  UNIQUE(class_uid,student)
);

CREATE TABLE review_scores
(
  review_uidINTEGER   REFERENCES review,
  factorVARCHAR(30)   REFERENCES factor,
  score INTEGER,

  uid   SERIALPRIMARY KEY,
  UNIQUE(review_uid,factor)
);

My problem is now I do not know how to write a single query that can pull the average 
of all 8 factors at once,
grouped my department as above.  If it is a specific department it is trivial, but for 
all departments at once I would
need to use two group by statements in the same SQL query.

I'm sure there is a simple solution, possibly using sub-queries which I'm not very 
farmiliar with.  I am attaching the
database schema below in case it would make things clearer.

TIA!

CREATE TABLE term
(
  name  VARCHAR(30)   PRIMARY KEY
);

CREATE TABLE semester
(
  term  VARCHAR(30)   REFERENCES term ON UPDATE 
CASCADE,
  year  INTEGER,
  lockedBOOLEAN   DEFAULT TRUE,

  uid   SERIALPRIMARY KEY,
  UNIQUE(term,year)
);

CREATE TABLE college
(
  name  VARCHAR(30)   PRIMARY KEY
);

CREATE TABLE department
(
  department_id VARCHAR(4)PRIMARY KEY,
  name  VARCHAR(30)   NOT NULL,
  college   VARCHAR(30)   REFERENCES college   ON UPDATE 
CASCADE
);

CREATE TABLE degree
(
  name  VARCHAR(30)   PRIMARY KEY
);

CREATE TABLE professor
(
  first_nameVARCHAR(30)   NOT NULL,
  last_name VARCHAR(30)   NOT NULL,
  email_address VARCHAR(30),
  degree_type   VARCHAR(30)   REFERENCES degree,
  undergrad_univVARCHAR(50),
  grad_univ VARCHAR(50),
  major VARCHAR(20),
  comment   TEXT,

  uid   SERIALPRIMARY KEY
);

CREATE TABLE professor_department_link
(
  prof_uid  INTEGER   REFERENCES professor,
  dept  VARCHAR(4)REFERENCES department,
  UNIQUE(prof_uid,dept)
);

CREATE TABLE email_domain
(
  domainVARCHAR(20)   PRIMARY KEY
);

CREATE TABLE student
(
  passwdVARCHAR(30)   NOT NULL,
  email_prefix  VARCHAR(30)   NOT NULL,
  email_domain  VARCHAR(20)   REFERENCES email_domain ON UPDATE 
CASCADE,
  authenticated BOOLEAN   DEFAULT FALSE,

  screen_name   VARCHAR(20)   PRIMARY KEY,
  UNIQUE(email_prefix,email_domain)
);

CREATE TABLE course
(
  deptVARCHAR(4)REFERENCES departmentON UPDATE CASCADE,
  cours

Re: [SQL] Sql and paradox

2000-08-28 Thread Fabrice Scemama

> Lalit wrote:
> 
> I want to know the incompatibilities between Paradox text files and
> SQL database.

None. Paradox databases are clean.



Re: [SQL] Tutorial

2000-08-28 Thread Christopher Sawtell

On Fri, 25 Aug 2000, Alessandro Valenti wrote:
> Does someone know a free downloadable tutorial on RDBMS usage for
> beginners?

This is Bruce Momjian's book. It's pretty good, Bruce has a good command of
English. It's intended to be a beginners guide. You will need the Adobe Acrobat
reader to view it.

http://www.postgresql.org/docs/awbook.html

This is the "traditional WWW SQL Tutorial".

http://w3.one.net/~jhoffman/sqltut.htm

There are literally _hundreds_ of them. For more go to:-

http://www.google.com/search?q=SQL+Tutorial&btnG=Google+Search

Sorry I do not know of any in Italian, but this Google query might produce
something for you:- ( set the search language to Italian before searching. )

http://www.google.com/search?q=Italian+SQL+Tutor&btnG=Google+Search

-- 
Sincerely etc.,

 NAME   Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN45863470
 EMAIL  csawtell @ xtra . co . nz
 CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me <<--




Re: [SQL] shared memory leak in 7.0.2?

2000-08-28 Thread Tom Lane

[EMAIL PROTECTED] writes:
>   i've been running 7.0.2 for the last month or so, and I've had to
> reboot my redhat linux box twice to clear up a shared memory leak
> issue. Essentially with the DB running for about 2weeks with large
> amounts of usage, eventually the Os runs out of shared memory and the
> db crashes and fails to restart. The only way to get the db back
> online is to reboot.

I haven't seen this reported before.  Are you sure Postgres deserves
the blame, rather than some other package?  Postgres' use of shared
memory is fixed for the life of a postmaster, so unless you're
constantly restarting the postmaster I don't see how we could be leaking
shmem.

However, rather than speculate, let's get some hard facts.  Try using
"ipcs -m -a" to keep track of shared mem allocations, and see what usage
is creeping up over time.

regards, tom lane



Re: [SQL] shared memory leak in 7.0.2?

2000-08-28 Thread Tom Lane

Pierre Padovani <[EMAIL PROTECTED]> writes:
>   Here is the current output of that ipc command:

Looks pretty reasonable --- the three shmem segments look to be about
what postgres should be using (I take it you've got -B set to 350 or
so).

>  If postgres were to crash for some reason. Would the shared memory be
> left in never never land?

In theory the postmaster should release those segments when it's shut
down, or failing that reuse 'em when it's restarted.  We have heard
occasional reports of this failing to happen on some platforms; but
again, unless you're restarting the postmaster on a regular basis that
doesn't seem like it'd be the issue.  Anyway, keep an eye on things with
ipcs and we'll see what's going on...

regards, tom lane



Re: [SQL] shared memory leak in 7.0.2?

2000-08-28 Thread Pierre Padovani

Tom,
  Thanks for that command. I never knew that existed. The only reason I
blame postgres at this point, is that the only thing that has changed on
this machine in the past month was upgrading postgres to 7.0.2 as well
as upgrading perl.  Of the two perl is used not nearyl as much as
postgres.

  Here is the current output of that ipc command:

[root@kahuna pierre]# ipcs -m -a

-- Shared Memory Segments 
keyshmid owner perms bytes nattchstatus  
0x0052e2ca 0 postgres  700   144   2 
0x0052e2c1 1 postgres  600   3769344   2 
0x0052e2c7 2 postgres  600   66060 2 
0x 3 llee  600   46084 6 dest
0x 4 www   600   46084 11dest

-- Semaphore Arrays 
key   semid owner perms nsems status  
0x0052e2ce 0 postgres  600   16
0x0052e2cf 1 postgres  600   16

-- Message Queues 
key   msqid owner perms used-bytes  messages
0x 0 root  700   0   0   


 If postgres were to crash for some reason. Would the shared memory be
left in never never land? If this were the case, and I'm using most if
not all of the available shared memory on startup of postgres, then this
would bring about the problems I'm seeing. Does this make sense?

 Pierre

Tom Lane wrote:
> 
> [EMAIL PROTECTED] writes:
> >   i've been running 7.0.2 for the last month or so, and I've had to
> > reboot my redhat linux box twice to clear up a shared memory leak
> > issue. Essentially with the DB running for about 2weeks with large
> > amounts of usage, eventually the Os runs out of shared memory and the
> > db crashes and fails to restart. The only way to get the db back
> > online is to reboot.
> 
> I haven't seen this reported before.  Are you sure Postgres deserves
> the blame, rather than some other package?  Postgres' use of shared
> memory is fixed for the life of a postmaster, so unless you're
> constantly restarting the postmaster I don't see how we could be leaking
> shmem.
> 
> However, rather than speculate, let's get some hard facts.  Try using
> "ipcs -m -a" to keep track of shared mem allocations, and see what usage
> is creeping up over time.
> 
> regards, tom lane



[SQL] Re: [GENERAL] sorting in UNICODE table

2000-08-28 Thread Tatsuo Ishii

> I'm use postgresql-7.0.2. It's compiled with unicode support
> (./configure --enable-multibyte=UNICODE ...)
> I have a table which contains both latin and non-latin letters. All they are in 
>UTF-8 encoding. When
> I try to sort the rows
> 
> ( SELECT * FROM my_table ORDER BY sort_field )
> 
> I receive strange error: the rows that begin with ascii symbols are ordered while 
>all other - are not!

I guess this is because UTF-8 strings are sorted in the order of the
physical representation. Can you show me sample data and its desired
order?

--
Tatsuo Ishii




[SQL] better way

2000-08-28 Thread Sherwin Daganato

Is there a better way to write this:

SELECT a.oid_fld FROM for_payment a
WHERE a.serial_fld <> 2
AND EXISTS
(SELECT b.char_fld FROM for_payment b
WHERE b.serial_fld = 2
AND b.char_fld = a.char_fld)

Table for_payment
+-++---+
 | serial_fld   |  char_fld  |  oid_fld   | 
+-++---+
 | 1   |  test1   |  456701  | 
 | 2   |  test1   |  456702  | 
 | 3   |  test1   |  456703  | 
 | 4   |  test2   |  456704  | 
 | 5   |  test3   |  456705  | 
+-++---+

sample problem:
Assuming that I pick 2 in serial_fld.
How do I get the oid_fld of the rows with char_fld equal
to the char_fld of 2?
I should get these:

+---+
 |  oid_fld   | 
+---+
 |  456701  | 
 |  456702  | 
+---+

Thanks.






[SQL] pg_attribute_relid_attnam_index problem after log disk filled up

2000-08-28 Thread Palle Girgensohn

Hi!

What's this? What to do? Shall I bother?

pp=> vacuum;
NOTICE:  Index pg_attribute_relid_attnam_index: NUMBER OF
INDEX' TUPLES (3094) IS NOT THE SAME AS HEAP' (3093)

The database is rather large, and the time to run vacuum is too
short, so it feels like something is stopping the vacuum too
early. The problem started when the log partition (where
postmaster logging output is written) was full, and some
backends crashed. This is fixed, but it seems that postgres is
not fully recovered.

PostgreSQL 6.5.2 on i386-unknown-freebsd3.3, compiled by cc 
Running on FreeBSD 3.5-RELEASE  (SMP kernel).

Cheers,
Palle

-- 
 Partitur Informationsteknik AB
Wenner-Gren Center +46 8 566 280 02  
113 46 Stockholm   +46 70 785 86 02  
Sweden [EMAIL PROTECTED]



Re: [SQL] pg_attribute_relid_attnam_index problem after log disk filled up

2000-08-28 Thread Tom Lane

Palle Girgensohn <[EMAIL PROTECTED]> writes:
> What's this? What to do? Shall I bother?

> pp=> vacuum;
> NOTICE:  Index pg_attribute_relid_attnam_index: NUMBER OF
> INDEX' TUPLES (3094) IS NOT THE SAME AS HEAP' (3093)

Under 6.5, if vacuum doesn't get rid of the message then I think the
only way to do so is to dump and reload the database.  (I'd strongly
recommend updating to 7.0.2 while you do that.)

The message in itself is not catastrophic, but it does raise the
question of what other damage there might be.  Updating would be
a good idea anyway, considering all the bugs that got fixed between
6.5 and 7.0.

> The problem started when the log partition (where
> postmaster logging output is written) was full, and some
> backends crashed.

Did they actually crash, or just hang up waiting for space to become
available for the log file?  That really shouldn't have been much of
a problem, AFAICS.

regards, tom lane



Re: [SQL] better way

2000-08-28 Thread Renato De Giovanni

Didn't test this, but I think it should also work:

SELECT a.oid_fld
FROM for_payment a, for_payment b
WHERE b.serial_fld = 2
AND b.char_fld = a.char_fld
AND a.serial_fld <> 2

--
Renato
Sao Paulo - SP - Brasil
[EMAIL PROTECTED]

> Is there a better way to write this:
>
> SELECT a.oid_fld FROM for_payment a
> WHERE a.serial_fld <> 2
> AND EXISTS
> (SELECT b.char_fld FROM for_payment b
> WHERE b.serial_fld = 2
> AND b.char_fld = a.char_fld)
>
> Table for_payment
> +-++---+
>  | serial_fld   |  char_fld  |  oid_fld   |
> +-++---+
>  | 1   |  test1   |  456701  |
>  | 2   |  test1   |  456702  |
>  | 3   |  test1   |  456703  |
>  | 4   |  test2   |  456704  |
>  | 5   |  test3   |  456705  |
> +-++---+
>
> sample problem:
> Assuming that I pick 2 in serial_fld.
> How do I get the oid_fld of the rows with char_fld equal
> to the char_fld of 2?
> I should get these:
>
> +---+
>  |  oid_fld   |
> +---+
>  |  456701  |
>  |  456702  |
> +---+
>
> Thanks.





Re: [SQL] Can I get this all in one query?

2000-08-28 Thread Renato De Giovanni

I don't have a postgresql instalation right now to do some tests, but maybe it works...

SELECT crs.dept AS department,
   ROUND(AVG(CAST(rvs1.score AS FLOAT)) ,2) AS snooze,
   ROUND(AVG(CAST(rvs2.score AS FLOAT)) ,2) AS professional,
   ROUND(AVG(CAST(rvs3.score AS FLOAT)) ,2) AS personality,
   ROUND(AVG(CAST(rvs4.score AS FLOAT)) ,2) AS grading,
   ROUND(AVG(CAST(rvs5.score AS FLOAT)) ,2) AS effectiveness,
   ROUND(AVG(CAST(rvs6.score AS FLOAT)) ,2) AS knowledge,
   ROUND(AVG(CAST(rvs7.score AS FLOAT)) ,2) AS accent,
   ROUND(AVG(CAST(rvs8.score AS FLOAT)) ,2) AS enthusiasism
  FROM review rvw, class cls, course crs, review_scores rvs1, review_scores rvs2, 
  WHERE rvw.class_uid=cls.uid AND cls.course_uid=crs.uid
  AND   rvw.uid = rvs1.review_uid
  AND   rvs1.factor = "factor_1"
  AND   rvw.uid = rvs2.review_uid
  AND   rvs2.factor = "factor_2"
  ...
  GROUP BY crs.dept;

HTH,
--
Renato
Sao Paulo - SP - Brasil
[EMAIL PROTECTED]

> I'm designing a database/website that will allow students to "grade" the 
>professors/classes the students attend.
> There are eight different "factors" that the students assign grades on.  Until 
>tonight I had one table that kept the
> scores assigned by students.  This table name REVIEW had a field named for each 
>factor.  IE:
>
> CREATE TABLE review(
> class_uid INTEGER   REFERENCES class,
> student   VARCHAR(20)   REFERENCES student,
> snooze   INTEGER,
> professional INTEGER,
> personality   INTEGER,
> gradingINTEGER,
> effectivenessINTEGER,
> knowledge   INTEGER,
> accentINTEGER,
> enthusiasismINTEGER,
>
> uid SERIAL  PRIMARY KEY,
> UNIQUE(class_uid,student)
> )
>
> THis allowed me to write simple queries that would pull averages for a 
>college,department, a course, a professor,
> etc.  Example query:
>
> //Returns averages in all 8 factors of every department
> SELECT crs.dept AS department,
>ROUND(AVG(CAST(rvw.snoozeAS FLOAT)) ,2) AS snooze,
>ROUND(AVG(CAST(rvw.professional  AS FLOAT)) ,2) AS professional,
>ROUND(AVG(CAST(rvw.personality   AS FLOAT)) ,2) AS personality,
>ROUND(AVG(CAST(rvw.grading   AS FLOAT)) ,2) AS grading,
>ROUND(AVG(CAST(rvw.effectiveness AS FLOAT)) ,2) AS effectiveness,
>ROUND(AVG(CAST(rvw.knowledge AS FLOAT)) ,2) AS knowledge,
>ROUND(AVG(CAST(rvw.accentAS FLOAT)) ,2) AS accent,
>ROUND(AVG(CAST(rvw.enthusiasism  AS FLOAT)) ,2) AS enthusiasism
>   FROM review rvw, class cls, course crs
>   WHERE rvw.class_uid=cls.uid AND cls.course_uid=crs.uid
>   GROUP BY crs.dept;
>
> However, in a developer meating tonight it was decided that the factors (which are 
>in another table in the database)
> should not be "hard coded" into the review table, but rather a new table should be 
>created implementin the many to
> many relationship.  The revised review table(s) looks like so:
>
> CREATE TABLE review
> (
>   class_uid INTEGER   REFERENCES class,
>   student   VARCHAR(30)   REFERENCES student,
>   comments  TEXT,
>
>   uid   SERIALPRIMARY KEY,
>   UNIQUE(class_uid,student)
> );
>
> CREATE TABLE review_scores
> (
>   review_uidINTEGER   REFERENCES review,
>   factorVARCHAR(30)   REFERENCES factor,
>   score INTEGER,
>
>   uid   SERIALPRIMARY KEY,
>   UNIQUE(review_uid,factor)
> );
>
> My problem is now I do not know how to write a single query that can pull the 
>average of all 8 factors at once,
> grouped my department as above.  If it is a specific department it is trivial, but 
>for all departments at once I would
> need to use two group by statements in the same SQL query.
>
> I'm sure there is a simple solution, possibly using sub-queries which I'm not very 
>farmiliar with.  I am attaching the
> database schema below in case it would make things clearer.
>
> TIA!
>
> CREATE TABLE term
> (
>   name  VARCHAR(30)   PRIMARY KEY
> );
>
> CREATE TABLE semester
> (
>   term  VARCHAR(30)   REFERENCES term ON UPDATE 
>CASCADE,
>   year  INTEGER,
>   lockedBOOLEAN   DEFAULT TRUE,
>
>   uid   SERIALPRIMARY KEY,
>   UNIQUE(term,year)
> );
>
> CREATE TABLE college
> (
>   name  VARCHAR(30)   PRIMARY KEY
> );
>
> CREATE TABLE department
> (
>   department_id VARCHAR(4)PRIMARY KEY,
>   name  VARCHAR(30)   NOT NULL,
>   college   VARCHAR(30)   REFERENCES college   ON UPDATE 
>CASCADE
> );
>
> CREATE TABLE degree
> (
>   name  VARCHAR(30)   PRIMARY KEY
> );
>
> CREATE TAB

Re: [SQL] pg_attribute_relid_attnam_index problem after log disk filled up

2000-08-28 Thread Palle Girgensohn

Tom Lane wrote:
> 
> Palle Girgensohn <[EMAIL PROTECTED]> writes:
> > What's this? What to do? Shall I bother?
> 
> > pp=> vacuum;
> > NOTICE:  Index pg_attribute_relid_attnam_index: NUMBER OF
> > INDEX' TUPLES (3094) IS NOT THE SAME AS HEAP' (3093)
> 
> Under 6.5, if vacuum doesn't get rid of the message then I think the
> only way to do so is to dump and reload the database.  (I'd strongly
> recommend updating to 7.0.2 while you do that.)
> 
> The message in itself is not catastrophic, but it does raise the
> question of what other damage there might be.  Updating would be
> a good idea anyway, considering all the bugs that got fixed between
> 6.5 and 7.0.

I continued this discussion, in more depth, on the pgsql-admin
list. I finally "gave up" and dumped|restored, updating not
7.0.2, but 6.5.3, since we are not just ready testing our
application with pg7 yet. soon. There are som futile, but
still, SQL differences.

> > The problem started when the log partition (where
> > postmaster logging output is written) was full, and some
> > backends crashed.
> 
> Did they actually crash, or just hang up waiting for space to become
> available for the log file?  That really shouldn't have been much of
> a problem, AFAICS.

Crashed when I killed them, if memory serves me (maybe the sig
6 ones, but I can't verify 100%).

$ dmesg
.
pid 52915 (postgres), uid 70 on /usr/local: file system full
[logging was to /usr/local  *blush* :-/ ]
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 52915 (postgres), uid 70 on /usr/local: file system full
pid 53230 (postgres), uid 70: exited on signal 6 (core dumped)
pid 53357 (postgres), uid 70: exited on signal 6 (core dumped)
pid 53479 (postgres), uid 70: exited on signal 11 (core dumped)
pid 53481 (postgres), uid 70: exited on signal 11 (core dumped)
pid 53505 (postgres), uid 70: exited on signal 11 (core dumped)
pid 53510 (postgres), uid 70: exited on signal 11 (core dumped)


Cheers,
Palle



[SQL] Test

2000-08-28 Thread Stuart Foster

Please ignore.


Thanks