[GENERAL] Listing privileges on a schema

2013-08-16 Thread David Salisbury
Hello, Is there a query out there where I can get a list of permissions associated to a schema? Something like the below query that I can do for a table, but for a schema instead? SELECT grantee, privilege_type FROM

[GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
I would think this would be possible. I'm on 9.0.8 I have a reference between two tables, and want to populate a field in one table with a value that's in the referenced table ( based on the FK reference of course ). with row as ( select my.atmos_site_id, my.stationid from my_stations my,

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
On 5/31/13 4:21 PM, Jeff Janes wrote: On Fri, May 31, 2013 at 2:37 PM, David Salisbury salisb...@globe.gov mailto:salisb...@globe.gov wrote: I would think this would be possible. I'm on 9.0.8 I have a reference between two tables, and want to populate a field in one table

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
On 5/31/13 4:45 PM, Bosco Rama wrote: On 05/31/13 15:33, David Salisbury wrote: And without trying too much ;), I'll bet there is no way to do this in SQL proper. i.e. I can't correlate an update with a select stmt, as in a correlated sub-query sort of way. So for this to work I would

Re: [GENERAL] Installing PostgreSQL on OSX Server

2013-01-28 Thread David Salisbury
On 1/28/13 1:05 PM, François Beausoleil wrote: I would stay away from MacPorts. Gotta agree on that one. The last time I have been working with PostgreSQL on MacOS X, I used the installer from http://www.postgresqlformac.com/ There's also a different approach, that I've never

Re: [GENERAL] PostgreSQL and WMS/WFS Service

2012-10-09 Thread David Salisbury
that, and with Geoserver.. http://en.wikipedia.org/wiki/GeoServer -ds On 10/9/12 4:58 PM, Greg Williamson wrote: You might look at the GIS extension, PostGIS:http://postgis.refractions.net/ Not sure how much yu need to do, but a company I used to work for ran a WMS service off of an

Re: [GENERAL] Custom prompt

2012-09-24 Thread David Salisbury
On 9/24/12 12:20 PM, cr...@gtek.biz wrote: Good afternoon, When accessing PostgreSQL via psql, is it possible to make use of a custom prompt? I would like something like postgres=# instead of just postgres=#. My search was fruitless (see next paragraph). And if I'm allowed two questions in

Re: [GENERAL] pg_dump -Fd must create directory

2012-09-13 Thread David Salisbury
It looks to me like you're misusing git.. You should only git init once, and always use that directory. Then pg_dump, which should create one file per database with the file name you've specified. Not sure of the flags but I'd recommend plain text format. I'm also unsure what you mean by

Re: [GENERAL] Hi,Frirends, are there any commands in pgsql/bin/ corresponding create tablespace?

2012-08-06 Thread David Salisbury
On 8/6/12 3:31 AM, Magnus Hagander wrote: On Mon, Aug 6, 2012 at 11:22 AM, sunpengblueva...@gmail.com wrote: Hi,Frirends, Are there any commands in pgsql/bin/ corresponding create tablespace? I know: createuser== create role createdb==create database Hi! No, but you can

Re: [GENERAL] Procedural Languages

2012-05-31 Thread David Salisbury
On 5/31/12 8:36 AM, John Townsend wrote: There are least 10 Procedural Languages http://en.wikipedia.org/wiki/PL/pgSQL available for PostGreSQL. The one that comes with the installation is PL/pgSQL. Which ones do you use and why? I've often wondered how these external languages perform,

Re: [GENERAL] timestamps, formatting, and internals

2012-05-30 Thread David Salisbury
On 5/30/12 9:42 AM, Adrian Klaver wrote: Think I realize where the confusion is now. When Jasen mentioned integer datetimes he was referring to the internal storage format Postgres uses to record the datetime value. Via the magic of programming(others will have to fill that part in) the

Re: [GENERAL] timestamps, formatting, and internals

2012-05-29 Thread David Salisbury
On 5/27/12 12:25 AM, Jasen Betts wrote: The query: show integer_datetimes; should return 'on' which means timestamps are microsecond precision if it returns 'off' your database was built with floating point timstamps and equality tests will be unreliable, I find that rather interesting. I

[GENERAL] timestamps, formatting, and internals

2012-05-18 Thread David Salisbury
I'm trying to debug an intermittent problem I'm seeing in one of our rollup scripts. I'll try to summarize. A table has a measured_at field, of which I calculate another time value based on that field and a longitude value, called solar_noon, and I summarize min/max values grouped around

Re: [GENERAL] timestamps, formatting, and internals

2012-05-18 Thread David Salisbury
Actually, figured I'd post the whole function, painful as it might be for anyone to read. If anyone sees something that's a bit of a risk ( like perhaps the whole thing ;) On 5/18/12 5:19 PM, David Salisbury wrote: I'm trying to debug an intermittent problem I'm seeing in one of our rollup

Re: [GENERAL] timestamps, formatting, and internals

2012-05-18 Thread David Salisbury
Oh.. and while I'm polluting this list (sorry) it's a timestamp field without a time zone. thanks for any ideas, -Dave -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] default value returned from sql stmt

2012-03-29 Thread David Salisbury
In trying to get an sql stmt to return a default value, I read in the docs.. The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for

Re: [GENERAL] default value returned from sql stmt

2012-03-29 Thread David Salisbury
On 3/29/12 4:26 PM, Chris Angelico wrote: On Fri, Mar 30, 2012 at 9:16 AM, David Salisburysalisb...@globe.gov wrote: development=# select coalesce(anum,100) from t1 where anum = 4; What you have there is rather different from COALESCE, as you're looking for a case where the row completely

Re: [GENERAL] Having a problem with RoR-3.1.1 and Pg-9.1

2012-02-27 Thread David Salisbury
On 2/27/12 9:51 AM, James B. Byrne wrote: The options seem to be run the script as the owner of the plpgsql EXTENSION or do not include the comment. How does one instruct pg_dump not to include the COMMENT for the plpgsql extension? The case in question is the automated creation of an sql

Re: [GENERAL] Optimise PostgreSQL for fast testing

2012-02-23 Thread David Salisbury
On 2/23/12 9:06 AM, Jack Christensen wrote: As another Rails developer using PostgreSQL I think I can explain the use case. In standard Rails usage, the ORM handles all SQL query generation and thus the application is database agnostic. It is typical to use SQLite in development and testing

Fwd: Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread David Salisbury
On 2/16/12 7:27 AM, Andreas Kretschmer wrote: Musial, Jan (GIUB)jan.mus...@giub.unibe.ch wrote: smallint,month smallint,day smallint,time_stamp date); I would like to That's silly, use one (and only one) field, timestamp (or timestamptz) Don't use never ever multiple columns for the same

Re: [GENERAL] Strategy for Primary Key Generation When Populating Table

2012-02-09 Thread David Salisbury
On 2/9/12 10:08 AM, Rich Shepard wrote: I have reports containing macroinvertebrate collection data for several hundred (or several thousand) of taxa. There is no natural key since there are multiple rows for each site/date pair. Years ago Joe Celko taught me to seek natural keys whenever

Re: [GENERAL] Strategy for Primary Key Generation When Populating Table

2012-02-09 Thread David Salisbury
On 2/9/12 5:25 PM, Rich Shepard wrote: For water quality data the primary key is (site, date, param) since there's only one value for a given parameter collected at a specific site on a single day. No surrogate key needed. Yea. I was wondering if the surrogate key debate really boils down to

Re: [GENERAL] self referencing table.

2012-01-18 Thread David Salisbury
On 1/17/12 6:00 PM, Chris Travers wrote: On Tue, Jan 17, 2012 at 4:31 PM, David Salisburysalisb...@globe.gov wrote: I've got a table: Taxa Column |Type +- id | integer |

Re: [GENERAL] self referencing table.

2012-01-18 Thread David Salisbury
On 1/18/12 9:46 AM, David Salisbury wrote: On 1/17/12 6:00 PM, Chris Travers wrote: On Tue, Jan 17, 2012 at 4:31 PM, David Salisburysalisb...@globe.gov wrote: I've got a table: Taxa Column | Type +- id | integer | parent_id | integer

[GENERAL] self referencing table.

2012-01-17 Thread David Salisbury
I've got a table: Taxa Column |Type +- id | integer | parent_id | integer | taxonomic_rank | character varying(32) | latin_name | character

Re: [GENERAL] Refine Form of My querry

2011-12-29 Thread David Salisbury
On 12/29/11 3:11 AM, saqi...@igis.nust.edu.pk wrote: Hi every1 how are u all??? Members i am new in postgres and want to work on pgrouting but i am facing some issue with it. Will u please help me??? I have loaded my line shapefile in pgadmin environment, which creates a table name 'Route',

Re: [GENERAL] exclusive OR possible within a where clause?

2011-10-17 Thread David Salisbury
On 10/14/11 10:58 AM, David Fetter wrote: On Thu, Oct 13, 2011 at 07:49:59PM -0400, Tom Lane wrote: David Salisburysalisb...@globe.gov writes: Short version, is there a way to implement an exclusive OR in a where clause? The boolean operator will do the trick. (x = y) (a = b)

Re: [GENERAL] exclusive OR possible within a where clause?

2011-10-17 Thread David Salisbury
On 10/17/11 1:19 PM, John R Pierce wrote: On 10/17/11 12:15 PM, David Salisbury wrote: is the same as !=, which is different than the fabled XOR I was hoping for. In fact they would never equal. F != F - false F != T - true T != F - true T != T - false how is that different than XOR

Re: [GENERAL] exclusive OR possible within a where clause?

2011-10-17 Thread David Salisbury
On 10/17/11 2:12 PM, John R Pierce wrote: On 10/17/11 12:40 PM, David Salisbury wrote: something --- 1 2 select * from test where ( something = 1.5 + .5 ) .XOR. ( something = 1.5 - .5 ); well, something[1] = 1, so thats FALSE .XOR. TRUE, which is TRUE and, something[2] = 2, so

[GENERAL] exclusive OR possible within a where clause?

2011-10-13 Thread David Salisbury
I'm guessing that this isn't possible, but you guys are pretty smart. :) Short version, is there a way to implement an exclusive OR in a where clause? table1 dt1(timestamp) - 3 mins 5 mins 7 mins table2 dt2(timestamp), timedifference(interval) --- --

Re: [GENERAL] Error: timestamp with timezone + interval is not immutable while creating index

2011-10-13 Thread David Salisbury
On 10/13/11 4:38 PM, Phil Couling wrote: Hi All I've got a table with (amongst others) two fields: last_updated timestamp with time zone; update_cycle interval; I'd like to create an index on these, to index time next update time (last_updated + update_cycle). When I try this I get an error

[GENERAL] create table as select... with auto increment id ?

2011-07-25 Thread David Salisbury
We all know i can create table freaky as select abunchofstuff. I work with rails developers and they are fussy about having an auto incrementing id field. Is there a way I can eak that out of the above type statement, or am I stuck with creating the table and no short cuts? create table

[GENERAL] timezone help?

2011-07-19 Thread David Salisbury
I'm a bit new to PG, and having troubles with timestamps. The docs list: timestamp [ (p) ] [ without time zone ] 8 bytes both date and time 4713 BC 5874897 AD 1 microsecond / 14 digits timestamp [ (p) ] with time zone8 bytes both date and time, with time zone 4713 BC

[GENERAL] sql or pgsql question, accessing a created value

2011-07-11 Thread David Salisbury
Hope someone's out there for this one. Basically I'm creating a summary table of many underlying tables in one select statement ( though that may have to change ). My problem can be shown in this example.. select my_function( timeofmeasurement, longitude ) as solarnoon, extract(epoch