[GENERAL] from string to table...?

2001-03-22 Thread will trillich
let's say you have the name of a table in a string. 'mytable' you also have field names, such as 'lookupfield' 'valuefield' which would be assembled like this select valuefield from mytable where lookupfield = '?' is there a way to write sql/plpgsql that'll take a var

Re: [GENERAL] Updates on Views?

2001-03-22 Thread Tom Lane
will trillich <[EMAIL PROTECTED]> writes: > is it possible to have a rule DO INSTEAD more-than-one-thing? Sure. Observe the CREATE RULE reference page: CREATE RULE name AS ON event TO object [ WHERE condition ] DO [ INSTEAD ] action where action can be: NOTHING | query | ( query ; que

[GENERAL] internationalizing text

2001-03-22 Thread will trillich
so who's got a clever implementation of cross-linguistic texts? create table something ( id serial, yadayada int4, whatever date, mumble float8, en varchar(50), -- english es varchar(50), -- e

Re: [GENERAL] How to inspect blocked queries

2001-03-22 Thread Tom Lane
"Randall F. Kern" <[EMAIL PROTECTED]> writes: > I have an web application that sometimes hangs. When I run ps I see a > postgresql thread that says "INSERT waiting" (I don't have the exact > text in front of me, but it's similar to that). When this happens my > only recourse is to restart my web

Re: [GENERAL] Updates on Views?

2001-03-22 Thread will trillich
On Thu, Mar 22, 2001 at 07:14:49PM -0600, will trillich wrote: > CREATE VIEW who AS > SELECT * from _who; > > CREATE RULE > who_insert > AS ON > INSERT TO who > DO INSTEAD > INSERT INTO "_who" ( >

Re: [GENERAL] psql slow connection

2001-03-22 Thread Tom Lane
"datactrl" <[EMAIL PROTECTED]> writes: > I use a win32 psql to connect to a linux box. It will take about 20 seconds > to connect to postgres server while linux and my PC are in a LAN. A first guess is that there's something broken about your DNS setup, and that you're suffering a DNS lookup time

[GENERAL] psql slow connection

2001-03-22 Thread datactrl
I use a win32 psql to connect to a linux box. It will take about 20 seconds to connect to postgres server while linux and my PC are in a LAN. My linux runs dhcpd, smb, and internet sharing, do they matter? JACK ---(end of broadcast)--- TIP 5: Have

[GENERAL] Re: Problem migrating dump to latest CVS snapshot.

2001-03-22 Thread Tom Lane
Gunnar R|nning <[EMAIL PROTECTED]> writes: > Seems you hit the nail with your theory : > sf-ng=# select date_part('seconds', a_accesstime) from access_log where > a_accesstime > '2000-10-24 15:14:59' limit 1; > date_part > --- > 59.997 > (1 row) Ah-hah. And we print that with a "%.

Re: [GENERAL] Foreign keys/unique values and views

2001-03-22 Thread Martijn van Oosterhout
On Thu, Mar 22, 2001 at 06:33:16PM -0500, Jan Wieck wrote: > Einar Karttunen wrote: > How do you put a UNIQUE constraint on the entire inheritance > hierarchie? Easy. You make a unique index that covers an entire inheritance hierarchy. If lots of table inherit a field "id" from a single

[GENERAL] Re: [HACKERS] SPI example does not work for 7.1beta4

2001-03-22 Thread Tom Lane
Limin Liu <[EMAIL PROTECTED]> writes: > By the way, did you change the whole archetecture of SPI invocation? No, I told you: what's broken here is the textout() call. Attached is the updated example. > I put > --- >SPI_connect(); >SPI_exec("create temp table tbl_tmp (n int);",0); >S

Re: [HACKERS] SPI example does not work for 7.1beta4

2001-03-22 Thread Tom Lane
Limin Liu <[EMAIL PROTECTED]> writes: > I am learning and using SPI. In PostgreSQL documentation chapter "Server > Programming Interface," there is a small example name "execq(text, > int)". > This example works as the document says on 7.0.3 and earlier version, > but this example DOES NOT work on

Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Stephan Szabo
On Thu, 22 Mar 2001, Jonas Bengtsson wrote: > Hello, > I have problems with using OID as PK. I have created a > UNIQUE INDEX on the oid on a relation called CourseEvents. > The relation that is supposed to have a FK to CourseEvents > is CourseEventsForums and it has a field called ceid which

RE: Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Jonas Bengtsson
Title: RE: Re: [GENERAL] OID as Primary Key Isn’t is better to use nextval(). If there are many simultaneous users vurrval might give the value of another insert.     /Jonas B   -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Michael Ansley

RE: Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Michael Ansley
Title: RE: Re: [GENERAL] OID as Primary Key And you can get the last SERIAL inserted using currval. MikeA >> -Original Message- >> From: Brent R. Matzelle [mailto:[EMAIL PROTECTED]] >> Sent: 22 March 2001 16:36 >> To: [EMAIL PROTECTED] >> Subject: Re: Re: [GENERAL] OID as Primary

Re: Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Brent R. Matzelle
--- Jonas Bengtsson <[EMAIL PROTECTED]> wrote: > Can't you do a dump with the oid's? Yes, but I would never suggest it. > But when I want to know the primary key of the inserted row > I have to do an extra select query. If I use oid I just use > pg_getlastoid() in php. > And it is redundant d

Re: [GENERAL] Changing from rpm to Compiled version

2001-03-22 Thread Brent R.Matzelle
3/22/2001 12:55:39 AM, "Joseph" <[EMAIL PROTECTED]> wrote: >What all must I do to change from the rpm installed version to the >compilable version? > >Do I need to uninstall the rpms? No, you can have both versions on the same system. --- Brent R. Matzelle Software Engineer Information Services

[GENERAL] creating a trigger to write to a different table

2001-03-22 Thread Peter Choe
can i use pl/pgsql to write a trigger to update a separate table? for example if i have a table student: nametext, id text, group int, statint, and another table status: stattext group int count int and i update the stat in the student table, can i update the count column

Re: Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Jonas Bengtsson
Can't you do a dump with the oid's? But when I want to know the primary key of the inserted row I have to do an extra select query. If I use oid I just use pg_getlastoid() in php. And it is redundant data to store another integer. Comments? /Jonas B > Jonas Bengtsson <[EMAIL PROTECTED]> wri

Re: [GENERAL] non-existent user "28"

2001-03-22 Thread Tom Lane
"Tamsin" <[EMAIL PROTECTED]> writes: > I'm not sure how the database got in this state - would this happen when I > drop & recreate a user? Yes. There's no crosscheck to see if you still have active GRANTs for the user being deleted. (Which is bad but that's how it is at the moment.) > Is ther

Re: [GENERAL] PG UPDATE question

2001-03-22 Thread Tom Lane
Jeff Butera <[EMAIL PROTECTED]> writes: > UPDATE STUDENT_ANSWERS SET CORRECT=QA.CORRECT > FROM QUESTION_ANSWERS QA,STUDENT_ANSWERS SA > WHERE SA.CORRECT=null > AND SA.QUESTIONS_ID=QA.QUESTIONS_ID > AND SA.ANSWERS_ID=QA.ANSWERS_ID; What you've got here is a three-way join between

Re: [GENERAL] OID as Primary Key

2001-03-22 Thread Tom Lane
Jonas Bengtsson <[EMAIL PROTECTED]> writes: > I have problems with using OID as PK. This strikes me as a fairly bad idea in any case. What happens if you must dump and reload your database? Better to use a SERIAL column as primary key. regards, tom lane ---

Re: [GENERAL] transaction aborted with error

2001-03-22 Thread Anand Raman
I dont think so .. Transactions need to be atomic.. Either succeed or fail.. I thik what postgressql does is quite OK only a little irritating if u are issuing command thru the psql terminal.. Anand On Thu, Mar 22, 2001 at 10:15:54AM +0100, DaVinci wrote: > Hello. I have a problem with Postgresql

Re: [GENERAL] Foreign keys/unique values and views

2001-03-22 Thread Einar Karttunen
On Thu, 22 Mar 2001, Richard Huxton wrote: > > I have to admit I've never tried referencing a view with a foreign key. I > don't know if it's possible and I have to admit the idea makes me > uncomfortable. Can't give a good reason why, but I'd apply constraints at > the table level. if one can ref

Re: [GENERAL] Changing from rpm to Compiled version

2001-03-22 Thread Richard Huxton
From: "Joseph" <[EMAIL PROTECTED]> > What all must I do to change from the rpm installed version to the > compilable version? > > Do I need to uninstall the rpms? In theory, you could probably run both, but it's probably easier to pg_dump your databases, uninstall the rpms and compile the source

[GENERAL]

2001-03-22 Thread Daniel Francisco Sachet
unsubscribe Daniel Francisco Sachet Diretor de Tecnologia de Informação IFX do Brasil - www.ifx.com.br +55 11 3365-5860 +55 11 9119-0083 [EMAIL PROTECTED] ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[GENERAL] non-existent user "28"

2001-03-22 Thread Tamsin
Hi, when I pg_dump my database, I get lines like: GRANT SELECT on "tablename" to "28"; When I restore from the dump file, I get errors: ERROR: aclparse: non-existent user "28" The dump file does contain grants for the real users which exist in the database, and I've checked pg_shadow, and there

[GENERAL] Re: transaction aborted with error

2001-03-22 Thread J.H.M. Dassen (Ray)
DaVinci <[EMAIL PROTECTED]> wrote: > When I am in middle of transaction and there is an error, for example > caused by trying to insert a tupla with a "not null" value without valor, > I get error: > > NOTICE: current transaction is aborted, queries ignored until end of > transaction b

[GENERAL] transaction aborted with error

2001-03-22 Thread DaVinci
Hello. I have a problem with Postgresql 7.1 beta (Debian packages). When I am in middle of transaction and there is an error, for example caused by trying to insert a tupla with a "not null" value without valor, I get error: NOTICE: current transaction is aborted, queries ignored unt

Re: [GENERAL] after trigger question

2001-03-22 Thread Richard Huxton
From: "Feite Brekeveld" <[EMAIL PROTECTED]> > Stephan Szabo wrote: > > > On Thu, 22 Mar 2001, Feite Brekeveld wrote: > > > > > Hi, > > > > > > I have put an AFTER INSERT TRIGGER on a table. > > > > > > If the triggerfunction fails to do an operation shouldn't the insert > > > already have taken

[GENERAL] PG UPDATE question

2001-03-22 Thread Jeff Butera
I'm new to postgres and am having an UPDATE problem when using a join. I've got two tables like so: CREATE TABLE QUESTION_ANSWERS ( QUESTIONS_ID int4 NOT NULL, -- question ID ANSWERS_ID int4 NOT NULL, -- answer ID CORRECTboolean ); CREATE TABLE STUDENT_ANSWERS ( S

Re: [GENERAL] Really Dumb Question...(Dumping db)

2001-03-22 Thread Alvaro Herrera
On Wed, 21 Mar 2001, Tim Frank wrote: > John, > > Thanks for mentioning that fix :) I'm sure one could run sed or > something similar to remove that line at the top of the file after the > backup has completed (I shall have to try that sometime). It's probably easier to set PGUSER and PGP

[GENERAL] JOIN

2001-03-22 Thread Grant Furick
I am trying to output news. An article can have an image or not sometimes. Can someone help me get this to work in Postgres? select a.article_id, a.title, a.url, a.synopsis, a.publish_date, c.parent_category_id, c.category_id, c.category_name, i.server_image_name from ((article a JOIN articl

[GENERAL] OID as Primary Key

2001-03-22 Thread Jonas Bengtsson
Hello, I have problems with using OID as PK. I have created a UNIQUE INDEX on the oid on a relation called CourseEvents. The relation that is supposed to have a FK to CourseEvents is CourseEventsForums and it has a field called ceid which has oid as dtatype. But when I try to create a FK to t