[GENERAL] OID as Primary Key
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 that table I get following error: --- PostgreSQL said: ERROR: UNIQUE constraint matching given keys for referenced table "courseevents" not found Your query: ALTER TABLE CourseEventForums ADD CONSTRAINT RefCourseEvents43 FOREIGN KEY (ceid) REFERENCES CourseEvents(oid) --- What is wrong? Is it to prefer to use oid as PK? Or should I use SERIAL instead? I thought it might be more efficient to use oid and a waste of space to add another integer as PK. Thanks in advance, Jonas Bengtsson ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [GENERAL] Really Dumb Question...(Dumping db)
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 PGPASSWORD as needed, IMHO. They are self-explanatory, aren't they? You can use them at both ends to ease the backup stuff. -- Alvaro Herrera (alvherre[@]atentus.com) ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
[GENERAL] JOIN
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 article_category_assoc acs ON a.article_id = acs.article_id) JOIN category c ON c.category_id = acs.category_id) LEFT OUTER JOIN (image i JOIN article_image_assoc aia ON i.image_id = aia.image_id) ON a.article_id = aia.article_id where i.image_type_id = 1 and a.live_date = #CreateODBCDate(Now())# and a.active_ind = TRUE and a.status_id = 2 and c.category_id=#intCategoryID# Thanks ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[GENERAL] PG UPDATE question
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 ( STUDENTS_IDint4 NOT NULL, -- student ID QUESTIONS_ID int4 NOT NULL, -- question ID ANSWERS_ID int4 NOT NULL, -- answer ID CORRECTboolean ); The table QUESTION_ANSWERS is completely populated. The table STUDENT_ANSWERS has all fields except CORRECT populated. I want to write an update that'll copy CORRECT from QUESTION_ANSWERS into STUDENT_ANSWERS when the IDs match. Here's what I wrote: 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; It executes without an error and correctly returns the count of the records in the join, but the CORRECT field in STUDENT_ANSWERS is populated entirely with false regardless of what CORRECT is QUESTION_ANSWERS. Can anyone shed light on what I'm missing? -- Jeff Butera, Ph.D. Junk e-mail is like Department of Mathematics Computer Science plastic grocery bags: High Point Universitythey just seem to [EMAIL PROTECTED] multiply at will... http://linus.highpoint.edu/~jbuteraAnonymous ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [GENERAL] after trigger question
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 place ? It depends on what you mean by fails to do an operation. If it raises an actual error the transaction is going to be rolled back so the insert is effectively undone. The conversion of a timestring to an integer value fails because it is sometimes illegal formatted , but I would like to have the the original data inserted in the table as a string. Use a BEFORE INSERT trigger then to check/translate the timestring before you insert. - Richard Huxton ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[GENERAL] transaction aborted with error
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 until end of transaction block. I don't like this behaviour, is there any form of avoiding abortion of transaction on error?... Thanks. David ---(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
[GENERAL] Re: transaction aborted with error
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 block. I don't like this behaviour, is there any form of avoiding abortion of transaction on error?... Not really. One of the points of having transactions is that a transaction either succeeds (as a whole), or has no effect (rollback). Triggers can provide a workaround though. I ran into this problem with a table which contained log-like information which should be inserted only once, but wasn't (due to a misconfiguration in the system generating the logs). I solved it by having a trigger (BEFORE INSERT OR UPDATE) which RAISEd a NOTICE (so it's clear the workaround occurs) and returns NULL, causing the insert to be ignored. HTH, Ray -- Where do you want to go today? Confutatis maledictis, flammis acribus addictis. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[GENERAL] non-existent user 28
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 is no user 28. I'm not sure how the database got in this state - would this happen when I drop recreate a user? Is there something I can do about this? I couldn't see where in the system tables the permission info is stored. Thanks, Tamsin ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[GENERAL]
unsubscribe Daniel Francisco Sachet Diretor de Tecnologia de Informao 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
Re: [GENERAL] Changing from rpm to Compiled version
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. Compiling the source is straightforward enough, just make sure you've read the docs first. - Richard Huxton ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [GENERAL] Foreign keys/unique values and views
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 reference a table with a foreign key it makes possible to reference inheritance hierarchies. If I create a view from the parent with CREATE VIEW name SELECT * FROM parent; (in v.7.1) it should contain the entries from the children as well. Now if I could reference this view I could simulate referencing parent and child tables easily. What I have in mind is a hierarchy of persons all inheriting from a table called person. Different kinds of persons have different attributes but all have an id and name. What I want is that other tables could reference these persons easily. - Einar Karttunen ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [GENERAL] transaction aborted with error
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 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 until end of transaction block. I don't like this behaviour, is there any form of avoiding abortion of transaction on error?... Thanks. David ---(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 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [GENERAL] OID as Primary Key
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 ---(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: [GENERAL] PG UPDATE question
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 QUESTION_ANSWERS and two instances of STUDENT_ANSWERS (the update target and the SA alias). I doubt that's what you want. FROM in update should only be used for *additional* tables. The target table has no alias and must be spelled out: UPDATE STUDENT_ANSWERS SET CORRECT=QA.CORRECT FROM QUESTION_ANSWERS QA WHERE STUDENT_ANSWERS.CORRECT=null AND STUDENT_ANSWERS.QUESTIONS_ID=QA.QUESTIONS_ID AND STUDENT_ANSWERS.ANSWERS_ID=QA.ANSWERS_ID; 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: [GENERAL] non-existent user 28
"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 there something I can do about this? I couldn't see where in the system tables the permission info is stored. relacl column of pg_class. My advice would just be to ignore the errors on restore... that's about the easiest way to get rid of the dead grants while keeping the good ones. regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: Re: [GENERAL] OID as Primary Key
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] 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 Mvh, Jonas Bengtsson ---(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
[GENERAL] creating a trigger to write to a different table
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 in the status table to reflect the change. in the documents, i just see triggers used on one table. peter choe ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [GENERAL] Changing from rpm to Compiled version
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 Main Line Health Systems Tel: 610-240-4566 Pager: 610-640-8437 [EMAIL PROTECTED] ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: Re: [GENERAL] OID as Primary Key
--- 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 data to store another integer. You should not use oid's as primary keys just because you want to save a little HD space. I contributed a some code on PHPBuilder for a function that returns the insert id of a SERIAL primary key. You can view it here: http://www.phpbuilder.com/snippet/download.php?type=snippetid=304 . It works well for me and it does not kludge my code like using the oid does. Brent __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
RE: Re: [GENERAL] OID as Primary Key
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 Key --- 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 data to store another integer. You should not use oid's as primary keys just because you want to save a little HD space. I contributed a some code on PHPBuilder for a function that returns the insert id of a SERIAL primary key. You can view it here: http://www.phpbuilder.com/snippet/download.php?type=snippet=304 . It works well for me and it does not kludge my code like using the oid does. Brent __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] _ This e-mail and any attachments are confidential and may also be privileged and/or copyright material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an intended or authorised recipient of this e-mail or have received it in error, please delete it immediately and notify the sender by e-mail. In such a case, reading, reproducing, printing or further dissemination of this e-mail is strictly prohibited and may be unlawful. Intec Telecom Systems PLC. does not represent or warrant that an attachment hereto is free from computer viruses or other defects. The opinions expressed in this e-mail and any attachments may be those of the author and are not necessarily those of Intec Telecom Systems PLC. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. __
RE: Re: [GENERAL] OID as Primary Key
Title: RE: Re: [GENERAL] OID as Primary Key Isnt 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 Sent: Thursday, March 22, 2001 5:50 PM To: [EMAIL PROTECTED] Subject: 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 Key --- 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 data to store another integer. You should not use oid's as primary keys just because you want to save a little HD space. I contributed a some code on PHPBuilder for a function that returns the insert id of a SERIAL primary key. You can view it here: http://www.phpbuilder.com/snippet/download.php?type=snippetid=304 . It works well for me and it does not kludge my code like using the oid does. Brent __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] _ This e-mail and any attachments are confidential and may also be privileged and/or copyright material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an intended or authorised recipient of this e-mail or have received it in error, please delete it immediately and notify the sender by e-mail. In such a case, reading, reproducing, printing or further dissemination of this e-mail is strictly prohibited and may be unlawful. Intec Telecom Systems PLC. does not represent or warrant that an attachment hereto is free from computer viruses or other defects. The opinions expressed in this e-mail and any attachments may be those of the author and are not necessarily those of Intec Telecom Systems PLC. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. __
Re: [GENERAL] OID as Primary Key
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 has oid as dtatype. But when I try to create a FK to that table I get following error: --- PostgreSQL said: ERROR: UNIQUE constraint matching given keys for referenced table "courseevents" not found Your query: ALTER TABLE CourseEventForums ADD CONSTRAINT RefCourseEvents43 FOREIGN KEY (ceid) REFERENCES CourseEvents(oid) --- What is wrong? The message is a bit misleading. Oid isn't a "user" column, and currently you can only create references to user columns. Given the issues involved with oid (since it's system wide it rolls over faster than a serial, you have to make sure to dump with oids, the fact that you have much less control over its value if you need to do something), I'm not 100% sure that's a bad thing, although IIRC references to oid are on the todo list. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
Re: [GENERAL] Foreign keys/unique values and views
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 table the you can put a unique index on that field. All you need then is an index whose keys reference not tuple IDs but (table ID, tuple ID) pairs. Wow. I'm just thinking of how vacuum would deal with this. Probably not very well. But it would give inheritance hierarchies very efficient lookups rather than the implicit unioning done currently. Martijn ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[GENERAL] Re: Problem migrating dump to latest CVS snapshot.
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 "%.2f" sort of format, so it rounds off to 60.00. Even in IEEE arithmetic ;-) I've suggested before that timestamp output should round the timestamp value to two fractional digits *before* breaking it down into year/ month/etc. Seems like this is a perfect example of the necessity for that. Thomas, what say you? 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: [GENERAL] psql slow connection
"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 timeout before anything actually happens. regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[GENERAL] psql slow connection
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 you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [GENERAL] Updates on Views?
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" ( login, "password", hint, name, email, editor, status, modified, created, id ) VALUES ( NEW.login, NEW."password", NEW.hint, NEW.name, NEW.email, NEW.editor, 'U'::bpchar, -- uncertain until confirmed "timestamp"('now'::text), -- last mod "timestamp"('now'::text), -- created now nextval('_who_id_seq'::text) ); -- all non-mentioned fields from _who are silently -- ignored (and dropped). now that i think about it... is it possible to have a rule DO INSTEAD more-than-one-thing? create rule split_it as on insert to someview do instead insert into tableone then intert into tabletwo then insert into tablethree ... then update someothertable ... -- It is always hazardous to ask "Why?" in science, but it is often interesting to do so just the same. -- Isaac Asimov, 'The Genetic Code' [EMAIL PROTECTED] http://newbieDoc.sourceforge.net/ -- we need your brain! http://www.dontUthink.com/ -- your brain needs us! ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [GENERAL] How to inspect blocked queries
"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 webserver or database. Now most likely I have another transaction that hasn't been committed or locks tables in a different order, but I don't see it in the output from ps. Is there anyway for me to inspect the pending queries in postgesql so I can track this down? Sorry, no good way to do that at the moment. I'd suggest turning on query logging (-d2 to the postmaster, and make sure the stderr output is going somewhere and is not being suppressed by -S). When the hang occurs, you can look back in the log to see what other transactions are in progress. 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
[GENERAL] internationalizing text
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), -- espanol fr varchar(50), -- francais de varchar(50), -- deutsch ... ); or maybe create table something ( id serial, yadayada int4, whatever date, mumble float8, ... ); create table something_text ( id int4 references something(id), lang varchar(5), -- language code 'en-us','it','jp'... descr varchar(50) ); anybody done something like this? is there another concept or are these two the whole ball-o-wax? pro's and con's? -- It is always hazardous to ask "Why?" in science, but it is often interesting to do so just the same. -- Isaac Asimov, 'The Genetic Code' [EMAIL PROTECTED] http://newbieDoc.sourceforge.net/ -- we need your brain! http://www.dontUthink.com/ -- your brain needs us! ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [GENERAL] Updates on Views?
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 ; query ... ) | [ query ; query ... ] 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
[GENERAL] from string to table...?
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 varchar argument (table and field names) and be able to turn it into the appropriate query? i can see pg_class contains table info and pg_attribute has info for the fields ... is there a way (oids maybe?) to direct postgres to the right table for a search, given the name of the table in a varchar string? (and if so, how? :) -- It is always hazardous to ask "Why?" in science, but it is often interesting to do so just the same. -- Isaac Asimov, 'The Genetic Code' [EMAIL PROTECTED] http://newbieDoc.sourceforge.net/ -- we need your brain! http://www.dontUthink.com/ -- your brain needs us! ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [HACKERS] SPI example does not work for 7.1beta4
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 my 7.1 beta4. Hm. textout() can't be called that way anymore --- as indeed your compiler should have told you, if it's any good at all. I get execq.c: In function `execq': execq.c:13: warning: passing arg 1 of `textout' from incompatible pointer type execq.c:13: warning: passing arg 1 of `SPI_exec' makes pointer from integer without a cast Looks like the example is in need of update. Thanks for the report. regards, tom lane ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html