Re: [GENERAL] question about \encoding option of psql

2011-12-15 Thread Xiaobo Gu
Hi Adrian, I am on the Windows platform, how should I paste the command line. Regards, Xiaobo Gu On Thu, Dec 15, 2011 at 10:44 PM, Adrian Klaver wrote: > On Wednesday, December 14, 2011 10:12:40 pm Xiaobo Gu wrote: >> Hi, >> >> I know \encoding is a meta command to set client encoding on psql

Re: [GENERAL] null tablespace?

2011-12-15 Thread Raghavendra
On Fri, Dec 16, 2011 at 2:07 AM, Tony Capobianco wrote: > Awesome! We had about 200G worth of tables on our mount point that held > all our WAL datawhoops! Thanks for the below query. > > One last question, can I define a default tablespace per schema? I > haven't found anything by searchi

Re: [GENERAL] null tablespace?

2011-12-15 Thread Tony Capobianco
Awesome! We had about 200G worth of tables on our mount point that held all our WAL datawhoops! Thanks for the below query. One last question, can I define a default tablespace per schema? I haven't found anything by searching around. Thanks. Tony On Fri, 2011-12-16 at 00:23 +0530, Ragha

Re: [GENERAL] Philosophical question

2011-12-15 Thread Chris Angelico
On Fri, Dec 16, 2011 at 3:28 AM, Scott Marlowe wrote: > Debian / Ubuntu will release an updated pg pacakge days after a new > postgresql minor version comes out, but php?  It can be months or > years before a new minor version gets the go ahead The beauty of modern open source project management

Re: [GENERAL] Logical Aggregate Functions (eg ANY())

2011-12-15 Thread Marti Raudsepp
On Thu, Dec 15, 2011 at 18:10, Robert James wrote: > How do I do the equivalent of an ANY() or ALL() in PG Aggregate SQL? Note that in many cases, writing an EXISTS(SELECT ...) or NOT EXISTS(...) subquery is faster, since the planner can often optimize those to a single index access -- whereas an

Re: [GENERAL] LOCK DATABASE

2011-12-15 Thread Scott Marlowe
On Thu, Dec 15, 2011 at 10:17 AM, Eliot Gable wrote: > Is this bogus, or is it an upcoming feature? > > http://wiki.postgresql.org/wiki/Lock_database The page says: "This functionality is not implemented in PostgreSQL, and is not planned to be yet" So I'd gues it's an ansi SQL Spec command that

Re: [GENERAL] null tablespace?

2011-12-15 Thread Raghavendra
Its going in default tablespace i.e. base/global. Try this query, which give information on the default tablespaces. select spcname, case spcname when 'pg_default' then (select setting from pg_settings where name = 'data_directory')||'/base' when 'pg_global' then (select setting from pg_settings

Re: [GENERAL] Logical Aggregate Functions (eg ANY())

2011-12-15 Thread Kirill Simonov
On 12/15/2011 11:10 AM, Robert James wrote: I see Postgres (I'm using 8.3) has bitwise aggregate functions (bit_or), but doesn't seem to have logical aggregate functions. They are called BOOL_AND and BOOL_OR, see http://www.postgresql.org/docs/8.3/interactive/functions-aggregate.html Thanks,

[GENERAL] null tablespace?

2011-12-15 Thread Tony Capobianco
I have not defined my default tablespace: show default_tablespace ; default_tablespace However, I have tables with null tablespaces values in pg_tables: pg_dw=# select * from pg_tables where tablename = 'source_prev'; schemaname | tablename | tableowner | tab

Re: [GENERAL] CREATE OR REPLACE AGGREGATE

2011-12-15 Thread Merlin Moncure
On Thu, Dec 15, 2011 at 11:29 AM, Robert James wrote: > Is there anyway to do the equivalent of CREATE OR REPLACE AGGREGATE? > Or - maybe even better - CREATE AGGREGATE if it doesn't already exist? Well, you have DROP [IF EXISTS] which should cover at least some of the use cases. I'm not sure a

[GENERAL] CREATE OR REPLACE AGGREGATE

2011-12-15 Thread Robert James
Is there anyway to do the equivalent of CREATE OR REPLACE AGGREGATE? Or - maybe even better - CREATE AGGREGATE if it doesn't already exist? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] LOCK DATABASE

2011-12-15 Thread Eliot Gable
Is this bogus, or is it an upcoming feature? http://wiki.postgresql.org/wiki/Lock_database -- Eliot Gable "We do not inherit the Earth from our ancestors: we borrow it from our children." ~David Brower "I decided the words were too conservative for me. We're not borrowing from our children, w

Re: [GENERAL] Logical Aggregate Functions (eg ANY())

2011-12-15 Thread Merlin Moncure
On Thu, Dec 15, 2011 at 10:10 AM, Robert James wrote: > I see Postgres (I'm using 8.3) has bitwise aggregate functions > (bit_or), but doesn't seem to have logical aggregate functions. > > How do I do the equivalent of an ANY() or ALL() in PG Aggregate SQL? CREATE OR REPLACE FUNCTION OrAgg(bool

Re: [GENERAL] Streaming Replication Configuration

2011-12-15 Thread Raymond O'Donnell
On 15/12/2011 16:41, Carlos Mennens wrote: > Now I'm showing they want me to use the -c switch to connect but no > database is defined so is it implied that I need to add 'postgres' > maintenance database in there or something else? I meant to add that -c doesn't mean "connect"; instead it specifi

Re: [GENERAL] Streaming Replication Configuration

2011-12-15 Thread Gabriele Bartolini
On Thu, 15 Dec 2011 11:41:07 -0500, Carlos Mennens wrote: carlos@db1:~$ psql -c "SELECT pg_start_backup('label', true)" psql: FATAL: database "carlos" does not exist I forgot. You can also look at this: http://www.postgresql.org/docs/9.1/static/app-pgbasebackup.html Ciao, Gabriele -- Gabr

Re: [GENERAL] Streaming Replication Configuration

2011-12-15 Thread Gabriele Bartolini
Hi Carlos, On Thu, 15 Dec 2011 11:41:07 -0500, Carlos Mennens wrote: carlos@db1:~$ psql -c "SELECT pg_start_backup('label', true)" psql: FATAL: database "carlos" does not exist By default (unless changed at compile time or using environment variables), a client connection is instantiated u

Re: [GENERAL] Streaming Replication Configuration

2011-12-15 Thread Raymond O'Donnell
On 15/12/2011 16:41, Carlos Mennens wrote: > carlos@db1:~$ psql -c "SELECT pg_start_backup('label', true)" > psql: FATAL: database "carlos" does not exist > > Now I'm showing they want me to use the -c switch to connect but no > database is defined so is it implied that I need to add 'postgres' >

Re: [GENERAL] Double Denormalizing in Postgres

2011-12-15 Thread David Johnston
On Dec 15, 2011, at 11:27, Pavel Stehule wrote: > 2011/12/15 Robert James : >> To match the heavily denormalized format of a legacy app, I need to >> take a query which gives this: >> >> name | product | rent | own >> Bob | Car | true | false >> Bob | Car | false | true >> Bob | Bike | false | t

[GENERAL] Streaming Replication Configuration

2011-12-15 Thread Carlos Mennens
I'm attempting today to get streaming replication from the Wiki configured on my two 9.1.2 servers: http://wiki.postgresql.org/wiki/Streaming_Replication I'm on step #6 6. Make a base backup by copying the primary server's data directory to the standby server. $ psql -c "SELECT pg_start_backup('

Re: [GENERAL] Double Denormalizing in Postgres

2011-12-15 Thread Pavel Stehule
2011/12/15 Robert James : > To match the heavily denormalized format of a legacy app, I need to > take a query which gives this: > > name | product | rent | own > Bob | Car | true | false > Bob | Car | false | true > Bob | Bike | false | true > Bob | Truck | true | true > > and denormalize it into

Re: [GENERAL] Philosophical question

2011-12-15 Thread Scott Marlowe
On Thu, Dec 15, 2011 at 1:58 AM, Bèrto ëd Sèra wrote: > My main problem with PHP is that it has loads of issues upon changing > versions, there are a lot of applications based on it, and sooner or later > you bump into having one application in need for one version and another > being unable to r

[GENERAL] Double Denormalizing in Postgres

2011-12-15 Thread Robert James
To match the heavily denormalized format of a legacy app, I need to take a query which gives this: name | product | rent | own Bob | Car | true | false Bob | Car | false | true Bob | Bike | false | true Bob | Truck | true | true and denormalize it into this: name | rented_products | owned_produc

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Adrian Klaver
On Thursday, December 15, 2011 7:57:40 am Carlos Mennens wrote: > So after reading > http://www.postgresql.org/docs/9.1/interactive/backup-dump.html, That was not the link I posted. In fact I have never actually been to that page:) This is the link I posted: http://www.postgresql.org/docs/9.1/in

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Carlos Mennens
On Thu, Dec 15, 2011 at 11:09 AM, Raymond O'Donnell wrote: > The point here is that with the plain-text dump (the default output from > pg_dump), you can feed that directly to psql; but you have no control > over what is restored, or in what order, without editing the dump file > directly. > > If,

[GENERAL] Logical Aggregate Functions (eg ANY())

2011-12-15 Thread Robert James
I see Postgres (I'm using 8.3) has bitwise aggregate functions (bit_or), but doesn't seem to have logical aggregate functions. How do I do the equivalent of an ANY() or ALL() in PG Aggregate SQL? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscr

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Raymond O'Donnell
On 15/12/2011 15:57, Carlos Mennens wrote: > So after reading > http://www.postgresql.org/docs/9.1/interactive/backup-dump.html, > > I'm not sure why the manual shows you in "24.1. SQL Dump" & then > directly after in 24.1.1, they explain how to restore with psql as you > advised me not to. I got

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Carlos Mennens
On Thu, Dec 15, 2011 at 10:28 AM, Adrian Klaver wrote: > The reason I pointed to the manual links is that there is a lot of good > information in there. It deserves more than a skim:). Realistically, to get > the > most out of the dump/restore process you need to know the options available on > b

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Jay Levitt
Craig Ringer wrote: it's a *bit* of a tiny use case. It certainly is. Jay -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Tom Lane
Mike Christensen writes: > BTW, this table (RecipeMetadata) will only ever be used in a join. I > will never query it directly. But I'll query Recipes and join in > RecipeMetadata. In that case possibly you want the join key to be the index payload. regards, tom lane -

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Adrian Klaver
On Thursday, December 15, 2011 6:55:46 am Carlos Mennens wrote: > On Thu, Dec 15, 2011 at 9:37 AM, Adrian Klaver wrote: > > You know the fine manual covers this?: > > http://www.postgresql.org/docs/9.1/interactive/app-pgdump.html > > I've honestly skimmed the manual and it's very easy to use and

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Mike Christensen
On Thu, Dec 15, 2011 at 6:00 AM, Craig Ringer wrote: > On 12/15/2011 03:53 PM, Alban Hertroys wrote: >> >> Correct, but... >> That's not a particularly useful index to create. That index just contains >> values of true where the associated column equals true - you're storing the >> same informatio

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Carlos Mennens
On Thu, Dec 15, 2011 at 9:37 AM, Adrian Klaver wrote: > You know the fine manual covers this?: > http://www.postgresql.org/docs/9.1/interactive/app-pgdump.html I've honestly skimmed the manual and it's very easy to use and good but it covers so many aspects and sometimes I need a specific answer

Re: [GENERAL] question about \encoding option of psql

2011-12-15 Thread Adrian Klaver
On Wednesday, December 14, 2011 10:12:40 pm Xiaobo Gu wrote: > Hi, > > I know \encoding is a meta command to set client encoding on psql > prompt, but how can I set it inside the psql command line which will > be called inside shell scripts, > > psql -h 192.168.72.7 -U gpadmin -w -d miner_demo -c

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Adrian Klaver
On Thursday, December 15, 2011 5:33:17 am Carlos Mennens wrote: > I performed a pg_dump from my new 9.1.2 server but my question now is > importing the data. So I had 9.1.2 perform the dump and it's now on > the new server but what are (if any) the steps to restore or install > them into my new 9.

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Craig Ringer
On 12/15/2011 03:53 PM, Alban Hertroys wrote: Correct, but... That's not a particularly useful index to create. That index just contains values of true where the associated column equals true - you're storing the same information twice. It could be very handy if you have an extremely high selec

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Bèrto ëd Sèra
Hi! > Is there a way in psql client I can search my database tables for any > BYTEA columns? > What about just grepping your dump file for 'bytea'? :) Bèrto -- == If Pac-Man had affected us as kids, we'd all be running around in a darkened room munching pills and l

Re: [GENERAL] Server/Data Migration Advice

2011-12-15 Thread Carlos Mennens
On Mon, Dec 12, 2011 at 12:23 PM, Andreas Kretschmer wrote: > - use the pg_dumpall from the new version to make the dump, for instance >  pg_dumpall -h ... | psql (something like this, on the new >  host) I performed a pg_dump from my new 9.1.2 server but my question now is importing the data. S

Re: [GENERAL] Philosophical question

2011-12-15 Thread Chris Travers
On Thu, Dec 15, 2011 at 1:49 AM, Andreas wrote: > Am 15.12.2011 05:47, schrieb Darren Duncan: > >> Darren Duncan wrote: >>> >>> A practice I like that I've seen done for a federal-government scale >>> database program is to have each person using the application to login to >>> the database using

Re: [GENERAL] Controlling complexity in queries

2011-12-15 Thread Bèrto ëd Sèra
Hi, > Here the result of "SELECT * FROM test1v" depends on who issued the query. As a more general case, I sometimes load parameters into a utility table, and use them to dynamically restrict the view's output. Downside: it's a multistatement operation... however, when wrapping complex queries

Re: [GENERAL] Philosophical question

2011-12-15 Thread Andreas
Am 15.12.2011 05:47, schrieb Darren Duncan: Darren Duncan wrote: A practice I like that I've seen done for a federal-government scale database program is to have each person using the application to login to the database using their own temporary database user. How it works is that the databa

Re: [GENERAL] Controlling complexity in queries

2011-12-15 Thread Harald Fuchs
Jay Levitt writes: > * You want contextual queries. > > (I guess this is a special case of "you need non relational features".) > > In my case, I want all queries against content to be filtered by their > relevance to the current user. That can't go into a view, because > views don't have paramet

Re: [GENERAL] question about \encoding option of psql

2011-12-15 Thread Guillaume Lelarge
On Wed, 2011-12-14 at 22:26 -0800, John R Pierce wrote: > On 12/14/11 10:12 PM, Xiaobo Gu wrote: > > I know \encoding is a meta command to set client encoding on psql > > prompt, but how can I set it inside the psql command line which will > > be called inside shell scripts, > > > > psql -h 192.168

Re: [GENERAL] Philosophical question

2011-12-15 Thread Bèrto ëd Sèra
Hi! > To be fair, isn't that an argument against whatever the popular > programming language is of the day? I mean, we can all remember > Matt's Scripting Archive and Perl. > If I can add a personal opinion, my main reason to avoid PHP is not related to programmers at all. There are loads o

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-15 Thread Albe Laurenz
Mike Christensen wrote: > For the boolean column Foo in Table1, if I want to index all values of > TRUE, is this syntax correct? > > CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo; Yes, that is correct. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org

Re: [GENERAL] Locking Tables & Backup Inquiry

2011-12-15 Thread Albe Laurenz
Carlos Mennens wrote: >> 0 4 * * * /usr/bin/pg_dumpall>  pg_dumpall.$DATE.sql >> >> that'll run at 4am every day. > When I run the command in my shell (not in Cron), I'm prompted for my > login password. Should I change the permissions in pg_hba.conf and > enable INHERIT grants on my user? Should