Thread: Print database name
Is there a sql command to print out which database I am connected to? I am using "psql -f sqlFile" in a sh script to up date tables on multiple databases. I would like to have the sqlFile display the db name so I would know which output lines go with each db without having to count the output lines. Thanks, Woody ---------------------------------------- iGLASS Networks 211-A S. Salem St Apex NC 27502 (919) 387-3550 x813 www.iglass.net
On Thu, Apr 05, 2007 at 08:51:28AM -0400, Woody Woodring wrote: > Is there a sql command to print out which database I am connected to? SELECT current_database(); See "System Information Functions" in the documentation for other such functions. http://www.postgresql.org/docs/8.2/interactive/functions-info.html -- Michael Fuhr
I know you've probably discussed this in many places, but I have a crash right now I need to recover from, and I'm not finding documentation that fast. Where should I go? Below you can see the log on starting, after a kill -9 of a process brought Postgres down. After letting postgres run for a while, it seems to have fixed itself, and now the log does not suggest any corruption, and I can access it locally. However, TCP/IP connections are rejected. Any ideas? Is there a page/s with information on quick recovery after corruption? LOG: could not create IPv6 socket: Address family not supported by protocol LOG: database system was interrupted while in recovery at 2007-04-05 08:18:47 EDT HINT: This probably means that some data is corrupted and you will have to use the last backup for recovery. *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. Bear Stearns does not provide tax, legal or accounting advice. You should consult your own tax, legal and accounting advisors before engaging in any transaction. In order for Bear Stearns to comply with Internal Revenue Service Circular 230 (if applicable), you are notified that any discussion of U.S. federal tax issues contained or referred to herein is not intended or written to be used, and cannot be used, for the purpose of: (A) avoiding penalties that may be imposed under the Internal Revenue Code; nor (B) promoting, marketing or recommending to another party any transaction or matter addressed herein. ***********************************************************************
Apologies for the duplication - I've been having email problems. Jaime Silvela wrote: > I know you've probably discussed this in many places, but I have a > crash right now I need to recover from, and I'm not finding > documentation that fast. > Where should I go? > > Below you can see the log on starting, after a kill -9 of a process > brought Postgres down. > After letting postgres run for a while, it seems to have fixed itself, > and now the log does not suggest any corruption, and I can access it > locally. However, TCP/IP connections are rejected. Any ideas? > Is there a page/s with information on quick recovery after corruption? > > LOG: could not create IPv6 socket: Address family not supported by > protocol > LOG: database system was interrupted while in recovery at 2007-04-05 > 08:18:47 EDT > HINT: This probably means that some data is corrupted and you will > have to use the last backup for recovery. > > > > *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. Bear Stearns does not provide tax, legal or accounting advice. You should consult your own tax, legal and accounting advisors before engaging in any transaction. In order for Bear Stearns to comply with Internal Revenue Service Circular 230 (if applicable), you are notified that any discussion of U.S. federal tax issues contained or referred to herein is not intended or written to be used, and cannot be used, for the purpose of: (A) avoiding penalties that may be imposed under the Internal Revenue Code; nor (B) promoting, marketing or recommending to another party any transaction or matter addressed herein. ***********************************************************************
Jaime Silvela <JSilvela@Bear.com> writes: > Below you can see the log on starting, after a kill -9 of a process > brought Postgres down. > After letting postgres run for a while, it seems to have fixed itself, > and now the log does not suggest any corruption, and I can access it > locally. However, TCP/IP connections are rejected. Any ideas? 1. Please do not hijack existing threads for an unrelated question. 2. You must have changed postgresql.conf or pg_hba.conf to reject outside connections. This might have happened some time ago and only shown up upon postmaster restart, if you'd neglected to SIGHUP the postmaster after the change... regards, tom lane
1. Sorry, that was an accident. I sent a new thread to the list and it didn't make it. Thinking I had gotten the address wrong, I "replied to" this thread and accidentally hit send, forgetting to change the subject. My apologies, no hijacking was intended. 2. Close. The database was generally restarted with a script that would call postmaster with the "-i" option. The conf file never allowed TCP/IP connections, which didn't become apparent until I tried to restart using pg_ctl with no options. Thank you , and sorry again Jaime Tom Lane wrote: > Jaime Silvela <JSilvela@Bear.com> writes: > >> Below you can see the log on starting, after a kill -9 of a process >> brought Postgres down. >> After letting postgres run for a while, it seems to have fixed itself, >> and now the log does not suggest any corruption, and I can access it >> locally. However, TCP/IP connections are rejected. Any ideas? >> > > 1. Please do not hijack existing threads for an unrelated question. > > 2. You must have changed postgresql.conf or pg_hba.conf to reject > outside connections. This might have happened some time ago and only > shown up upon postmaster restart, if you'd neglected to SIGHUP the > postmaster after the change... > > regards, tom lane > > *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. Bear Stearns does not provide tax, legal or accounting advice. You should consult your own tax, legal and accounting advisors before engaging in any transaction. In order for Bear Stearns to comply with Internal Revenue Service Circular 230 (if applicable), you are notified that any discussion of U.S. federal tax issues contained or referred to herein is not intended or written to be used, and cannot be used, for the purpose of: (A) avoiding penalties that may be imposed under the Internal Revenue Code; nor (B) promoting, marketing or recommending to another party any transaction or matter addressed herein. ***********************************************************************
On Thu, Apr 05, 2007 at 11:17:49AM -0400, Jaime Silvela wrote: > 1. Sorry, that was an accident. I sent a new thread to the list and it > didn't make it. Thinking I had gotten the address wrong, I "replied to" > this thread and accidentally hit send, forgetting to change the subject. > My apologies, no hijacking was intended. Umm, changing the subject doesn't make a new thread. It looks like it does in some mailers, but it doesn't actually... Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.