Re: [GENERAL] dumb question

2016-06-02 Thread David G. Johnston
On Thu, Jun 2, 2016 at 5:44 PM, Kevin Grittner wrote: > On Thu, Jun 2, 2016 at 3:23 PM, David G. Johnston > wrote: > > On Thu, Jun 2, 2016 at 4:11 PM, John R Pierce > wrote: > >> Thanks all the below seem to do the trick. > > I doubt it -- using NOT IN requires (per the SQL specification) > han

Re: [GENERAL] dumb question

2016-06-02 Thread Kevin Grittner
On Thu, Jun 2, 2016 at 3:23 PM, David G. Johnston wrote: > On Thu, Jun 2, 2016 at 4:11 PM, John R Pierce wrote: >> Thanks all the below seem to do the trick. I doubt it -- using NOT IN requires (per the SQL specification) handling NULLs in a way that probably does not give you the answer you wan

Re: [GENERAL] dumb question

2016-06-02 Thread David G. Johnston
On Thu, Jun 2, 2016 at 4:11 PM, John R Pierce wrote: > On 6/2/2016 11:10 AM, Steve Clark wrote: > > Thanks all the below seem to do the trick. > > On 06/02/2016 01:58 PM, David G. Johnston wrote: > > select max(id) from yourtable where sts=0 and id not in (select ref_id > from yourtable); > > > s

Re: [GENERAL] dumb question

2016-06-02 Thread David G. Johnston
​ > -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto: > pgsql-general-ow...@postgresql.org] On Behalf Of Steve Clark > Sent: Thursday, June 2, 2016 9:56 AM > To: pgsql > Subject: [GENERAL] dumb question > > Hi List, > > I am a noob try

Re: [GENERAL] dumb question

2016-06-02 Thread Steve Clark
) from sometable where sts=0 -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Steve Clark Sent: Thursday, June 2, 2016 9:56 AM To: pgsql Subject: [GENERAL] dumb question Hi List, I am a noob trying to do something that

Re: [GENERAL] dumb question

2016-06-02 Thread Dann Corbit
7; ; pgsql Subject: Re: [GENERAL] dumb question This is your request, translated directly into SQL select max(id) from sometable where sts=0 and ref_id IS NULL Looking at your sample, it seems that sts is always 1 when ref_id exists, so it may possibly simplify to: select ma

Re: [GENERAL] dumb question

2016-06-02 Thread John R Pierce
On 6/2/2016 11:10 AM, Steve Clark wrote: Thanks all the below seem to do the trick. On 06/02/2016 01:58 PM, David G. Johnston wrote: select max(id) from yourtable where sts=0 and id not in (select ref_id from yourtable); select max(id) from yourtable where sts=0 and id not in (select ref_id

Re: [GENERAL] dumb question

2016-06-02 Thread Dann Corbit
Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Steve Clark Sent: Thursday, June 2, 2016 9:56 AM To: pgsql Subject: [GENERAL] dumb question Hi List, I am a noob trying to do something that seems like it should be easy but I can&#

[GENERAL] dumb question

2016-06-02 Thread Steve Clark
Hi List, I am a noob trying to do something that seems like it should be easy but I can't figure it out. I have a table like so: id | ref_id | sts -- 1 || 0 2 | 1 | 1 3 || 0 4 || 0 5 | 4 | 1 6 || 0 7 | 6 | 1 I want t

Re: [GENERAL] dumb question

2016-06-02 Thread Steve Clark
Thanks all the below seem to do the trick. On 06/02/2016 01:58 PM, David G. Johnston wrote: select max(id) from yourtable where sts=0 and id not in (select ref_id from yourtable); select max(id) from yourtable where sts=0 and id not in (select ref_id from yourtable); -- Stephen Clark

Re: [GENERAL] dumb question

2016-06-02 Thread Steve Crawford
On Thu, Jun 2, 2016 at 10:40 AM, Felipe Santos wrote: > > > 2016-06-02 14:23 GMT-03:00 Steve Crawford > : > >> Something like: >> >> select max(id) from yourtable where sts=0 and ref_id is null; >> >> That assumes that ref_id is null. It would help to see your table >> structure and the query yo

Re: [GENERAL] dumb question

2016-06-02 Thread David G. Johnston
On Thu, Jun 2, 2016 at 1:48 PM, Steve Crawford < scrawf...@pinpointresearch.com> wrote: > On Thu, Jun 2, 2016 at 10:40 AM, Felipe Santos > wrote: > >> I think sts=0 means ref_id is null >> >> So, what I think he wants to achieve is: >> >> select max(id) from yourtable where sts=0 and id not in (s

Re: [GENERAL] dumb question

2016-06-02 Thread Felipe Santos
2016-06-02 14:23 GMT-03:00 Steve Crawford : > Something like: > > select max(id) from yourtable where sts=0 and ref_id is null; > > That assumes that ref_id is null. It would help to see your table > structure and the query you tried that doesn't work. If ref_id is actually > a character string th

Re: [GENERAL] dumb question

2016-06-02 Thread Steve Crawford
Something like: select max(id) from yourtable where sts=0 and ref_id is null; That assumes that ref_id is null. It would help to see your table structure and the query you tried that doesn't work. If ref_id is actually a character string then you might need ref_id='' or coalesce(ref_id,'')='' if

Re: [GENERAL] dumb question

2016-06-02 Thread David G. Johnston
On Thursday, June 2, 2016, Steve Clark wrote: > Hi List, > > I am a noob trying to do something that seems like it should be easy but I > can't figure it out. > > I have a table like so: > > id | ref_id | sts > -- > 1 || 0 > 2 | 1 | 1 > 3 || 0 > 4 |

[GENERAL] dumb question

2016-06-02 Thread Steve Clark
Hi List, I am a noob trying to do something that seems like it should be easy but I can't figure it out. I have a table like so: id | ref_id | sts -- 1 || 0 2 | 1 | 1 3 || 0 4 || 0 5 | 4 | 1 6 || 0 7 | 6 | 1 I want t

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-24 Thread Kevin Grittner
Jasen Betts wrote: >On 2013-02-23, Raymond C. Rodgers wrote: >> On 02/23/2013 05:26 AM, Tom Lane wrote: >>> A "virtual" tsvector like that is probably going to be useless for >>> searching as soon as you get a meaningful amount of data, because the >>> only way the DB can implement a search is t

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-23 Thread Jasen Betts
On 2013-02-23, Raymond C. Rodgers wrote: > On 02/23/2013 05:26 AM, Tom Lane wrote: >> A "virtual" tsvector like that is probably going to be useless for >> searching as soon as you get a meaningful amount of data, because the >> only way the DB can implement a search is to compute the tsvector

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-23 Thread Raymond C. Rodgers
On 02/23/2013 05:26 AM, Tom Lane wrote: A "virtual" tsvector like that is probably going to be useless for searching as soon as you get a meaningful amount of data, because the only way the DB can implement a search is to compute the tsvector value for each table row and then examine it for the

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-23 Thread Tom Lane
Kevin Grittner writes: > Raymond C. Rodgers wrote: >> As I went to add a tsvector column, it occurred to me that it >> might be possible to add a dynamic tsvector column through the >> use of a view, so I created a temporary view with a command along >> the lines of: >> >> CREATE TEMPORARY

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-22 Thread Kevin Grittner
Raymond C. Rodgers wrote: > As I went to add a tsvector column, it occurred to me that it > might be possible to add a dynamic tsvector column through the > use of a view, so I created a temporary view with a command along > the lines of: > > CREATE TEMPORARY VIEW ftstest AS SELECT id, field1

[GENERAL] Dumb question involving to_tsvector and a view

2013-02-22 Thread Raymond C. Rodgers
Hi folks, I'm building a PHP script for a web site I'm developing. At the moment, there is absolutely no real data in the database, so obviously performance is pretty good right now. I'm in the midst of developing an administration page for the site, which will do a full text search on sev

Re: [GENERAL] Dumb question about binary cursors and #ifdefHAVE_INT64_TIMESTAMP

2007-12-11 Thread Dann Corbit
> -Original Message- > From: Alvaro Herrera [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 11, 2007 1:11 PM > To: Dann Corbit > Cc: [EMAIL PROTECTED]; pgsql-general@postgresql.org > Subject: Re: [GENERAL] Dumb question about binary cursors and > #ifdefHAVE_INT6

Re: [GENERAL] Dumb question about binary cursors and #ifdefHAVE_INT64_TIMESTAMP

2007-12-11 Thread Dann Corbit
> -Original Message- > From: Alvaro Herrera [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 11, 2007 1:11 PM > To: Dann Corbit > Cc: [EMAIL PROTECTED]; pgsql-general@postgresql.org > Subject: Re: [GENERAL] Dumb question about binary cursors and > #ifdefHAVE_INT6

Re: [GENERAL] Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

2007-12-11 Thread Alvaro Herrera
Dann Corbit wrote: > If I create a binary cursor on a recent version of PostgreSQL, how can I > tell if the timestamp data internally is an 8 byte double or an 8 byte > integer? > > I see an #ifdef that changes the code path to compute timestamps as one > type or the other, but I do not know how t

Re: [GENERAL] Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

2007-12-11 Thread Tom Lane
"Dann Corbit" <[EMAIL PROTECTED]> writes: > If I create a binary cursor on a recent version of PostgreSQL, how can I > tell if the timestamp data internally is an 8 byte double or an 8 byte > integer? PQparameterStatus(conn, "integer_datetimes") regards, tom lane

[GENERAL] Dumb question about binary cursors and #ifdef HAVE_INT64_TIMESTAMP

2007-12-11 Thread Dann Corbit
If I create a binary cursor on a recent version of PostgreSQL, how can I tell if the timestamp data internally is an 8 byte double or an 8 byte integer? I see an #ifdef that changes the code path to compute timestamps as one type or the other, but I do not know how to recognize the internal format

Re: [GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-13 Thread Shoaib Mir
Make sure you have stats collector enabled, if auto vacuum is doing the analyze and vacuum it should be recording that info in this view. For details on this you can have a look at --> http://www.postgresql.org/docs/8.2/interactive/monitoring-stats.html Just for a test try doing a VACUUM or ANALY

Re: [GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-13 Thread Pavan Deolasee
On 2/13/07, Walter Vaughan <[EMAIL PROTECTED]> wrote: select last_autovacuum, last_autoanalyze from pg_stat_all_tables; last_autovacuum | last_autoanalyze -+-- | ...snip lots of identically blank lines... |

Re: [GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-12 Thread Walter Vaughan
Shoaib Mir wrote: pg_stat_all_table view should help you: select last_autovacuum, last_autoanalyze from pg_stat_all_tables; select last_autovacuum, last_autoanalyze from pg_stat_all_tables; last_autovacuum | last_autoanalyze -+-- | ...snip lot

Re: [GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-12 Thread Shoaib Mir
pg_stat_all_table view should help you: select last_autovacuum, last_autoanalyze from pg_stat_all_tables; -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/9/07, Sic Transit Gloria Mundi <[EMAIL PROTECTED]> wrote: Hi, I couldnt find this on google, the archives, or the manual. But wit

Re: [GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-12 Thread Tom Lane
Sic Transit Gloria Mundi <[EMAIL PROTECTED]> writes: > I couldnt find this on google, the archives, or the manual. But with the > changes to what the autovacuum daemon logs, how can we verify it's doing its > thing? Is there a way to query the last time a table was vacuumed? But I > don't see

[GENERAL] Dumb question - how to tell if autovacuum is doing its job in 8.2.x

2007-02-12 Thread Sic Transit Gloria Mundi
Hi, I couldnt find this on google, the archives, or the manual. But with the changes to what the autovacuum daemon logs, how can we verify it's doing its thing? Is there a way to query the last time a table was vacuumed? But I don't see that in the system catalog. Thanks! -

Re: [GENERAL] dumb question

2006-02-12 Thread Michael Glaesemann
On Feb 13, 2006, at 11:47 , Craig White wrote: seems to be a lot of work just for this...the problem is trying to use rubyonrails and their 'migrations' which cause this... psql:db/development_structure.sql:211: ERROR: must be owner of schema public So how can I just 'munge' the system t

Re: [GENERAL] dumb question

2006-02-12 Thread Craig White
On Mon, 2006-02-13 at 11:39 +0900, Michael Glaesemann wrote: > On Feb 13, 2006, at 11:27 , Craig White wrote: > > > th-db_test=> ALTER SCHEMA public OWNER TO tobyhouse; > > ERROR: syntax error at or near "OWNER" at character 21 > > > > # rpm -q postgresql-server > > postgresql-server-7.4.8-1.RHEL

Re: [GENERAL] dumb question

2006-02-12 Thread Michael Glaesemann
On Feb 13, 2006, at 11:27 , Craig White wrote: th-db_test=> ALTER SCHEMA public OWNER TO tobyhouse; ERROR: syntax error at or near "OWNER" at character 21 # rpm -q postgresql-server postgresql-server-7.4.8-1.RHEL4.1 The docs I referred you to are for the current release. For earlier relea

Re: [GENERAL] dumb question

2006-02-12 Thread Craig White
On Mon, 2006-02-13 at 11:07 +0900, Michael Glaesemann wrote: > On Feb 13, 2006, at 10:29 , Craig White wrote: > > > How do I change the owner of a schema? > > > > ALTER SCHEMA "public" OWNER to "some_user"; #? > > http://www.postgresql.org/docs/current/interactive/sql-alterschema.html > > The

Re: [GENERAL] dumb question

2006-02-12 Thread Michael Glaesemann
On Feb 13, 2006, at 10:29 , Craig White wrote: How do I change the owner of a schema? ALTER SCHEMA "public" OWNER to "some_user"; #? http://www.postgresql.org/docs/current/interactive/sql-alterschema.html The docs explain this very situation. HTML documentation ships with the PostgreSQL

[GENERAL] dumb question

2006-02-12 Thread Craig White
How do I change the owner of a schema? ALTER SCHEMA "public" OWNER to "some_user"; #? Craig ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-11 Thread Jim C. Nasby
On Tue, Oct 11, 2005 at 02:22:23AM -0400, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > Out of curiosity... why don't we have unsigned ints? > > Quick, is 42 an int or an unsigned int? > > I think it'd create a slew of new ambiguous cases in the > numeric-datatype hierarchy, fo

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-11 Thread Jim C. Nasby
On Mon, Oct 10, 2005 at 11:52:40PM -0700, Dann Corbit wrote: > How about something like: > > CREATE DOMAIN unsigned_small AS smallint check (VALUE >= 0) > > CREATE DOMAIN unsigned_int AS integer check (VALUE >= 0) > > CREATE DOMAIN unsigned_big AS bigint check (VALUE >= 0) > > The objection mig

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-11 Thread Dann Corbit
ostgresql.org > Subject: Re: [GENERAL] Dumb question about serial's upper limit > > On Mon, Oct 10, 2005 at 10:59:03PM -0400, Tom Lane wrote: > > CSN <[EMAIL PROTECTED]> writes: > > > If integer's range is -2147483648 to +2147483647, why > > > i

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread Michael Glaesemann
On Oct 11, 2005, at 15:12 , Jim C. Nasby wrote: Out of curiosity... why don't we have unsigned ints? I for one would certainly use them for id fields, as well as some other places where I knew negative numbers weren't valid. Check the archives. I know this has come up a number of times in the

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Out of curiosity... why don't we have unsigned ints? Quick, is 42 an int or an unsigned int? I think it'd create a slew of new ambiguous cases in the numeric-datatype hierarchy, for what is really pretty darn small gain. We're already just barely getti

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread Jim C. Nasby
On Mon, Oct 10, 2005 at 10:59:03PM -0400, Tom Lane wrote: > CSN <[EMAIL PROTECTED]> writes: > > If integer's range is -2147483648 to +2147483647, why > > is serial's range only 1 to 2147483647 instead of 1 to > > about 4294967294? > > How are you going to stuff 4294967294 into an integer field, wh

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread Michael Glaesemann
On Oct 11, 2005, at 14:04 , CSN wrote: I was thinking about the types in the C code behind PostgreSQL, rather than types in PG itself. Been a long time since I coded in C but I thought it had unsigned ints and maybe data types could be mapped as so (pardon my ignorance about C/PG's inner workin

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread CSN
--- Tom Lane <[EMAIL PROTECTED]> wrote: > CSN <[EMAIL PROTECTED]> writes: > > If integer's range is -2147483648 to +2147483647, > why > > is serial's range only 1 to 2147483647 instead of > 1 to > > about 4294967294? > > How are you going to stuff 4294967294 into an > integer field, which as > y

Re: [GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread Tom Lane
CSN <[EMAIL PROTECTED]> writes: > If integer's range is -2147483648 to +2147483647, why > is serial's range only 1 to 2147483647 instead of 1 to > about 4294967294? How are you going to stuff 4294967294 into an integer field, which as you just stated has an upper limit of 2147483647? If we had an

[GENERAL] Dumb question about serial's upper limit

2005-10-10 Thread CSN
If integer's range is -2147483648 to +2147483647, why is serial's range only 1 to 2147483647 instead of 1 to about 4294967294? CSN __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ ---

Re: [GENERAL] Dumb question about 8.1 beta test

2005-08-27 Thread Tom Lane
Mike Nolan <[EMAIL PROTECTED]> writes: > The notes on participating in the 8.1 beta suggest creating a dump using > both an old and new copy of pg_dump. > Does this mean we can't use pg_dumpall or that we have to restore both > dumps? (Or is that just a way of testing what works and what doesn'

[GENERAL] Dumb question about 8.1 beta test

2005-08-27 Thread Mike Nolan
The notes on participating in the 8.1 beta suggest creating a dump using both an old and new copy of pg_dump. Does this mean we can't use pg_dumpall or that we have to restore both dumps? (Or is that just a way of testing what works and what doesn't between older dump files and the beta release

Re: [GENERAL] Dumb question about count()

2005-07-22 Thread Ezequiel Tolnay
Benjamin Smith wrote: Now, I want to get a result like: classroom | students | seats 101A 0 25 101B22 30 102A11 0 ... etc. Something somewhat akin to select classroom.title, count(students.id) AS students, count(seats.id) AS seats from classrooms, students, seats wh

Re: [GENERAL] Dumb question about count()

2005-07-21 Thread Michael Fuhr
On Thu, Jul 21, 2005 at 10:09:07PM -0700, Benjamin Smith wrote: > select classroom.title, > count(students.id) AS students, > count(seats.id) AS seats > from classrooms, students, seats > where classrooms.id=students.classrooms_id > and classrooms.id=seats.id > > Except that it coun

[GENERAL] Dumb question about count()

2005-07-21 Thread Benjamin Smith
I'm sure I've done this before, but for some reason, my main noodle is drawing a blank. Assume we have three tables defined thusly: create table classrooms ( id serial unique not null, name varchar ); create table seats ( classrooms_id integer not null references classrooms(id), position var

[GENERAL] dumb question: multiple postmasters on Solaris

2001-05-23 Thread Andrew Sullivan
Hi, I believe this is a dumb question, and I have a sneaky feeling that I've seen something about this on the list before, but I can't find it in the archives. I am used to using PostgreSQL on Linux, but we have moved some of our work onto Solaris multiprocessor boxes. Now, I see multiple insta