Re: [SQL] Client Logging
Bryan White writes: > I sometimes need to be able to identify what client application is > causing messages that are appering in the backend log file. I've been thinking about that too a while ago, but it depends on whether you want to do this for auditing purposes, in which case > 1) An identification string passed when a connection is established. This > string would either be immediatly logged or included in the log entry for > any subsequent messages for that connection. is not reliable. If you want to have this on a cooperative basis, then > 3) A function that takes a string argument and calls elog. is probably reasonable. -- Peter Eisentraut Sernanders väg 10:115 [EMAIL PROTECTED] 75262 Uppsala http://yi.org/peter-e/Sweden
[SQL] Newbie question on how to check triggers created
Hi folks, Could someone please enlightenment me what command in psql i should use to show the various triggers and rules that i have created? Thanks alot in advance. Regards Damon /* Please be gentle with me, i'm a newbie. */
Re: [SQL] Newbie question on how to check triggers created
Chunky wrote: > > Could someone please enlightenment me what command in psql i should use > to show the various triggers and rules that i have created? These might work... select tgname from pg_trigger select rulename from pg_rewrite Regards, Ed Loehr
Re: [SQL] postmaster: init.d/start
Hi Daniel, thank you for your reply. There are some unanswered questions. Why does one have to consider multiple run levels? Doesn't run level 3 (network + X) implicate run level 2 (network)? So if I don't use XDM (or equivalent) and the system starts with a login shell only, it would start run level 2 services. And if I use XDM and the system starts using X it would also load run level 2 services? Markus Daniel Fairs wrote: > As to which runlevel you should start the postmaster in, well, you'll > probably want to start it in the runlevel(s) corresponding to full > multiuser mode, and multisuer mode with X (if applicable). On my RedHat > system, these are runlevels 3 and 5. I think they're different on a SuSE > system, 2 and 3 from memory. Check your /etc/inittab for details, it'll > tell you which runlevel corresponds to what mode of use. > it after the services that it depends on have started, so probably after > networking and maybe named, if you run it. I find that around 60-ish works
[SQL] Outer join in postgresql
I am looking for a way run an outer join in psql. Can anyone help? Informix has an "OUTER" keyword. I don't see anything like this in the docs for psql. Thanks much. -Pat Kay
Re: [SQL] Outer join in postgresql
On Mon, 12 Jun 2000, Patrick Kay wrote: > I am looking for a way run an outer join in psql. Can anyone help? > > Informix has an "OUTER" keyword. I don't see anything like this in the docs > for psql. > > Thanks much. > -Pat Kay > Hmmm... I don't now the exact definition of outer join. I feel it may somethink like this: SELECT * FROM a WHERE NOT EXISTS (SELECT id FROM b WHERE b.id=a.id); This works in postgresql, but doesn't use indices ;( I mean this runs an sequencial scan on a, and many index scan on b. The result may be done with a special hash-join, but not in current versions. I have a strange sens, in 7.1 it will be... regards -- nek;(
Re: [SQL] Outer join in postgresql
Patrick Kay wrote: > > I am looking for a way run an outer join in psql. Can anyone help? > > Informix has an "OUTER" keyword. I don't see anything like this in the docs > for psql. There are many examples on how to do this in the archives or via deja.com's power search. Regards, Ed Loehr
Re: [SQL] Outer join in postgresql
See the FAQ. It involves UNION. > Patrick Kay wrote: > > > > I am looking for a way run an outer join in psql. Can anyone help? > > > > Informix has an "OUTER" keyword. I don't see anything like this in the docs > > for psql. > > There are many examples on how to do this in the archives or via > deja.com's power search. > > Regards, > Ed Loehr > -- Bruce Momjian| http://www.op.net/~candle [EMAIL PROTECTED] | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup.| Drexel Hill, Pennsylvania 19026
[SQL] Becky is HERE !!!! 7970
Becky just turned 18. Here is one of her 1st nude photos !!! http://theownerhere.pussy.zoomfree.com/becky.htm gqn
Re: [SQL] Outer join in postgresql
On Mon, 12 Jun 2000, Patrick Kay wrote: > I am looking for a way run an outer join in psql. Can anyone help? > > Informix has an "OUTER" keyword. I don't see anything like this in the docs > for psql. > > Thanks much. > -Pat Kay Here is an example I have about simulating an outer join in PostgreSQL: (hope this is correct, I'm still a bit of a novice but getting better) CREATE TABLE master (m_id INTEGER, m_name TEXT); CREATE TABLE slave (m_id INTEGER, s_name TEXT); INSERT INTO master (m_id, m_name) VALUES (1, 'Satan'); INSERT INTO master (m_id, m_name) VALUES (2, 'God'); INSERT INTO slave (m_id, s_name) VALUES (1, 'Joe'); INSERT INTO slave (m_id, s_name) VALUES (1, 'Tom'); SELECT * FROM master m, slave s WHERE m.m_id = s.m_id UNION SELECT *, NULL, 'no slaves' FROM master m WHERE m.m_id NOT IN ( SELECT m_id FROM slave ); m_id | m_name | m_id | s_name --++--+--- 1 | Satan |1 | Joe 1 | Satan |1 | Tom 2 | God| | no slaves (3 rows) -- Oracle outer-join SELECT * FROM master m, slave s WHERE m.m_id = s.m_id (+); m_id | m_name | m_id | s_name --++--+--- 1 | Satan |1 | Joe 1 | Satan |1 | Tom 2 | God| | (3 rows) I keep a file at http://comptechnews.com/~reaster/dbdesign.html that has some info that might be useful to some people. -- Robert B. Easter
[SQL] Problem regarding 'select...as...'
Hi, I have a following query: "select equip_attr[1], equip_attr[2] as year, make from vehicle_tb;" which gives me the following error: "ERROR: Attribute 'make' not found" Is there something wrong with my "as" usage? Thanks - Bernie begin:vcard n:Huang;Bernie tel;fax:(604)664-9195 tel;work:(604)664-9172 x-mozilla-html:TRUE org:Environment Canada;Standards and Technology Services adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada version:2.1 email;internet:[EMAIL PROTECTED] title:Programmer x-mozilla-cpt:;0 fn:Bernie Huang end:vcard
[SQL] Re: [PHP-DB] Problem regarding 'select...as...'
On 2000-06-12, Bernie Huang stated: } "select equip_attr[1], equip_attr[2] } as year, make } from vehicle_tb;" } } which gives me the following error: } } "ERROR: Attribute 'make' not found" } } Is there something wrong with my "as" usage? Thanks Try: "select equip_attr[1] as year, equip_attr[2] as make" instead. HTH, /vjl/
[SQL] Simple search question
Hi, after running a script which performs an insert, a new tuple is created, and a serial number is generated for it. I want to write the new tuple data back to the screen, including the new serial number. My question is, do I have to do a search for the tuple just inserted in order to get the data back again? I am thinking there must be a faster, more efficient way. Thanks, Alex
Re: [SQL] Outer join in postgresql
There is no OUTER JOIN in postgres. You could use SELECT and UNION ALL. Jesus. On Mon, 12 Jun 2000, Patrick Kay wrote: > I am looking for a way run an outer join in psql. Can anyone help? > > Informix has an "OUTER" keyword. I don't see anything like this in the docs > for psql. > > Thanks much. > -Pat Kay >
[SQL] Re: Simple search question
On Tue, 13 Jun 2000 09:42:01 +1000, Alex <[EMAIL PROTECTED]> wrote: ]>Hi, ]> after running a script which performs an insert, a new tuple is ]>created, and a serial number is generated for it. I want to write the ]>new tuple data back to the screen, including the new serial number. ]> My question is, do I have to do a search for the tuple just inserted in ]>order to get the data back again? I am thinking there must be a faster, ]>more efficient way. ]>Thanks, ]>Alex What language is your "script" written in? Based on some previous posts, I guess you're talking about a PHP script. How did you add the tuple? I'd guess with a pg_Exec(connect_id,"INSERT "). From reading the doc, I think that you can get the row just inserted by using the pg_fetch_row() function, passing it the result from the pg_Exec and asking for row 0. I have not yet gotten anything running with PHP (lack of time to "play"), so I can't test this. If it doesn't work, I'd try using pg_GetLastOid() to get the OID of the inserted row. The use the pg_Exec and SELECT * WHERE OID=oid-value, followed by pg_fetch_row(). Just some thoughts. John
[SQL] Re: Simple search question
Hi, > What language is your "script" written in? Based on some previous posts, > I guess you're talking about a PHP script. How did you add the tuple? > I'd guess with a pg_Exec(connect_id,"INSERT "). From reading the doc, > I think that you can get the row just inserted by using the pg_fetch_row() > function, passing it the result from the pg_Exec and asking for row 0. OK, I just tried pg_fetch_array() and the above didn't work. > I have not yet gotten anything running with PHP (lack of time to "play"), For someone who hasn't had time to play, you certainly know alot about php :) If you need any examples, I'd be willing to post them, time permitting. I thought libpq was easy to use, this is very straightforward. I have been 'playing' with it for a few days, and it is my development tool of choice now. Of course, this is because of faster development time, don't expect Yahoo! to replace their cgi with PHP just yet. > so I can't test this. If it doesn't work, I'd try using pg_GetLastOid() > to get the OID of the inserted row. The use the pg_Exec and SELECT > * WHERE OID=oid-value, followed by pg_fetch_row(). Thanks John, and the other person that replied to my email (I know it is a bit of a stupid question, but in such an unpopulated list, I don't think there's any reason to post privately). This leads to another question. If someone adds another row during this, what will happen? Thanks, Alex
Re: [SQL] Re: Simple search question
Judging by the PHP Manual -- http://www.php.net/manual/function.pg-getlastoid.php -- it appears that the pg_GetLastOid command returns the last OID for the given result, and therefore would be unaffected by other inserted records. >From the manual: int pg_getlastoid (int result_id) -- can be used to retrieve the Oid assigned to an inserted tuple if the result identifier is used from the last command sent via pg_Exec() and was an SQL INSERT. This function will return a positive integer if there was a valid Oid. It will return -1 if an error occured or the last command sent via pg_Exec() was not an INSERT. Michael Fork - CCNA - MCP - A+ Network Support - Toledo Internet Access - Toledo Ohio On Tue, 13 Jun 2000, Alex wrote: > Hi, > > > What language is your "script" written in? Based on some previous posts, > > I guess you're talking about a PHP script. How did you add the tuple? > > I'd guess with a pg_Exec(connect_id,"INSERT "). From reading the doc, > > I think that you can get the row just inserted by using the pg_fetch_row() > > function, passing it the result from the pg_Exec and asking for row 0. > > OK, I just tried pg_fetch_array() and the above didn't work. > > > I have not yet gotten anything running with PHP (lack of time to "play"), > > For someone who hasn't had time to play, you certainly know alot about php :) > > If you need any examples, I'd be willing to post them, time permitting. > I thought libpq was easy to use, this is very straightforward. I have been > 'playing' with it for a few days, and it is my development tool of choice > now. Of course, this is because of faster development time, don't expect > Yahoo! to replace their cgi with PHP just yet. > > > so I can't test this. If it doesn't work, I'd try using pg_GetLastOid() > > to get the OID of the inserted row. The use the pg_Exec and SELECT > > * WHERE OID=oid-value, followed by pg_fetch_row(). > > Thanks John, and the other person that replied to my email (I know it is a > bit of a stupid question, but in such an unpopulated list, I don't think > there's any reason to post privately). > This leads to another question. If someone adds another row during this, > what will happen? > > Thanks, > Alex >
Re: [SQL] postmaster: init.d/start
Markus Wagner wrote: > > Hi Daniel, > > thank you for your reply. > > There are some unanswered questions. > Why does one have to consider multiple run levels? Doesn't run level 3 > (network + X) implicate run level 2 (network)? > So if I don't use XDM (or equivalent) and the system starts with a login > shell only, it would start run level 2 services. And if I use XDM and > the system starts using X it would also load run level 2 services? Not neccesarily. each run-level contains it's own list of services. They may, or may not, overlap. BTW, Runlevel3 is generally networking + NFS, NOT X. X is usually runlevel 5 (all depending on the variant). if you start a system not configured to go to X-RUnlevel, it will usually go to runlevel 3 (Don't recall ever seeing a default system go to runlevel two; Unix/Linux).
[SQL] sql foregein key
sir , i am working 6.5.2 postgresql in creation foregein key in table syntax i am writing is 1)create table gk (sno int primary key); 2)create table kk (sno int references gk, sname varchar(2)); i am getting message like this foregein key is not implemented . please write which version it supports . please send reply assp ganesh __ Do You Yahoo!? Yahoo! Photos -- now, 100 FREE prints! http://photos.yahoo.com
Re: [SQL] Problem regarding 'select...as...'
I think the correct way is SELECT equipo_attr[1] AS year, equip_attr[2] AS make FROM vehicle_tb; On Mon, 12 Jun 2000, Bernie Huang wrote: > Hi, I have a following query: > > "select equip_attr[1], equip_attr[2] > as year, make > from vehicle_tb;" > > which gives me the following error: > > "ERROR: Attribute 'make' not found" > > Is there something wrong with my "as" usage? Thanks > > > - Bernie >
Re: [SQL] sql foregein key
You need too add the library 'refint.so', which is included in the package (prior to v7). But you have to explicitly write a trigger in order to do this. Refer to the docs for more info. However this problem is solved when you migrate to v7. herbert On Mon, 12 Jun 2000, GANESH KUMAR wrote: > > sir , > > i am working 6.5.2 postgresql > in creation foregein key in table > > syntax i am writing is > 1)create table gk > (sno int primary key); > > 2)create table kk > (sno int references gk, > sname varchar(2)); > i am getting message like this foregein key is not > implemented . > please write which version it supports . > please send reply assp > > ganesh > > __ > Do You Yahoo!? > Yahoo! Photos -- now, 100 FREE prints! > http://photos.yahoo.com >