[SQL] How to query information schema from shell script

2006-10-27 Thread Jon Horsman
Hey, I'm trying to figure out how i can query the postgres information schema from a bourne shell script on linux. I need to know if a user/table exists. Does someone mind giving me a quick example of how this works, is this possible? Thanks, Jon. ---(end of

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread George Pavlov
I'm trying to figure out how i can query the postgres information schema from a bourne shell script on linux. I need to know if a user/table exists. Does someone mind giving me a quick example of how this works, is this possible? % for tn in `psql -Umnp -dmnp_gp -hstgdb0 -tA -cselect

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread A. Kretschmer
am Fri, dem 27.10.2006, um 9:31:03 -0400 mailte Jon Horsman folgendes: Hey, I'm trying to figure out how i can query the postgres information schema from a bourne shell script on linux. I need to know if a user/table exists. Does someone mind giving me a quick example of how You can do

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread William Leite Araújo
You can use -c option of psql client. Ex.: psql -p 5000 -d database -c SELECT * FROM information_schema.tables WHERE table_schema = 'public' 2006/10/27, Jon Horsman [EMAIL PROTECTED]: Hey,I'm trying to figure out how i can query the postgres informationschema from a bourne shell script on

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Jon Horsman
Thanks for the suggestions guys, i'll give this a try. Jon ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

[SQL] not able to execute query on spatial database.

2006-10-27 Thread vamsee movva
Hello all, I am working with spatial tables. i have two spatial data tables, one represents the whole state and another table represents the damaged locations in the state. My aim is to find number of damaged locations in every county or parish. Here i am giving the query i used to do this, could

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Jon Horsman
In my original email i forgot to mentioned i need to know if the database exists or not from the shell script. If it doesn't exist i would then create it. Currently i was just creating the db everytime our db script is run (since it doesn't hurt the db) but this generates the 'db already

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Jon Horsman
For more information, i know how this is done using the pg_catalog but have yet to find out how its done with the information schema. select * from pg_catalog.pg_database where datname='test' will work for me but i can't find a solution with the IS. I'd prefer to use the IS if its as easily

Re: [SQL] not able to execute query on spatial database.

2006-10-27 Thread Aaron Bono
On 10/27/06, vamsee movva [EMAIL PROTECTED] wrote: Hello all, I am working with spatial tables. i have two spatial data tables, one represents the whole state and another table represents the damaged locations in the state. My aim is to find number of damaged locations in every county or parish.

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread George Pavlov
simplest might be psql -l. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Horsman Sent: Friday, October 27, 2006 8:13 AM To: pgsql-sql@postgresql.org Subject: Re: [SQL] How to query information schema from shell script In my original email

[SQL] Function to reset sequence.....

2006-10-27 Thread Doug Hyde
I am a real newbie with PL/pgSQL, and with postgres, but here goes. The problem: when you import data into postgresql, there is no way to set the proper sequence on the primary key. For example, I could have a table with 2000 rows, some of which have been added/deleted in time, so the nextval

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Scott Marlowe
On Fri, 2006-10-27 at 10:12, Jon Horsman wrote: In my original email i forgot to mentioned i need to know if the database exists or not from the shell script. If it doesn't exist i would then create it. Currently i was just creating the db everytime our db script is run (since it doesn't

[SQL] Case Preservation disregarding case sensitivity?

2006-10-27 Thread beau hargis
Hello all. As this is my first post to this particular mailing list, let me preface this with a couple of items: 1) I have, indeed, searched far and wide for the answer to my question. I have read and understood the responses to similar posts posing similar questions. My next stop after this

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-27 Thread Frank Bax
At 07:23 PM 10/27/06, beau hargis wrote: I am aware of the double-quote 'feature' which indicates that an element should be treated in a case-sensitive way. This as been the 'answer' to every question of this sort. This 'feature' does not solve the problem and introduces other problems. If

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-27 Thread Joe
Hi Beau, On Fri, 2006-10-27 at 16:23 -0700, beau hargis wrote: I am hoping that there is an easy way to obtain case-preservation with case-insensitivity, or at the very least, case-preservation and complete case-sensitivity, or case-preservation and a consistant case-conversion strategy.

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Richard Broersma Jr
In my original email i forgot to mentioned i need to know if the database exists or not from the shell script. If it doesn't exist i would then create it. Currently i was just creating the db everytime our db script is run (since it doesn't hurt the db) but this generates the 'db already