[SQL] CREATE RULE ignored, what did I do wrong

2004-09-10 Thread andrew
OK, below is the dump of the table definition. Several other tables reference this and have ON DELETE CASCADE. In this table there is a rule for ON DELETE. The WHERE clause (NOT old.is_deleted) should always be the case, as the field is FALSE for all existing entries (checked). The cascading de

Re: [SQL] CREATE RULE ignored, what did I do wrong

2004-09-13 Thread andrew
I was trying to implement a pseudo-delete, where the (millions of) records in several child tables were actually deleted, but a flag was set in the summary table instead of deleting it, as an archiving mechanism. (If the flag was already set, the WHERE clause in the RULE should be false, and the

[SQL] MOVE in SQL vs PLPGSQL

2005-10-04 Thread andrew
I can't find a good way to skip over a large number of records in PLPGSQL (I want to fast-forward and I don't need the I/O of reading and throwing away hundreds of records.) In SQL, I could just use MOVE. That doesn't appear to be supported in PLPGSQL?! Help? ---(end of

[SQL] filtering after join

2006-01-25 Thread andrew
les generated by the join operation. How can I do that? Thanks! -- andrew ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] filtering after join

2006-01-25 Thread andrew
Sorry for the confusion. This is what i meant. Thanks, Michael. select * from (select * from A, B where A.a = B.b) as s where foo(s) < 2; On 1/25/06, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > andrew wrote: > > I want to use a UDF to filter tuples t that are generated afte

Re: [SQL] filtering after join

2006-01-26 Thread andrew
But the function foo() would produce different values for the two queries, so the result will be different. A simple example is foo() computes the sum of all the integer fields of the input record. On 1/26/06, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > andrew wrote: > > Sorry fo

Re: [SQL] filtering after join

2006-01-26 Thread andrew
How will the query planner do for a nesting query? Treat the subqueries as multiple queries and then link them together? where can I find the information (codes or documents)? Thanks. On 1/26/06, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > andrew wrote: > > But the function foo(

Re: [SQL] filtering after join

2006-01-27 Thread andrew
I can see the final plan by using the EXPLAIN command. But I want to know the procedure of the planner in handling nesting queries. Can you direct me to the corresponding part of the code and/or the documents? Thanks. On 1/26/06, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > andrew wrote

Re: [SQL] filtering after join

2006-01-27 Thread andrew
ect * from (select * from Person,Auction where Person.id=Auction.seller) as s where complete(s) ERROR: Cannot pass result of sub-select or join s to a function On 1/27/06, andrew <[EMAIL PROTECTED]> wrote: > I can see the final plan by using the EXPLAIN command. But I want to > know t

Re: [SQL] filtering after join

2006-01-27 Thread andrew
! On 1/27/06, Tom Lane <[EMAIL PROTECTED]> wrote: > andrew <[EMAIL PROTECTED]> writes: > > I got errors in this query. I have a function complete(record) which > > takes a generic record type data. But it seems cannot be applied to a > > sub-select result: > &g

Re: [SQL] filtering after join

2006-01-27 Thread andrew
<[EMAIL PROTECTED]> wrote: > andrew <[EMAIL PROTECTED]> writes: > > I got errors in this query. I have a function complete(record) which > > takes a generic record type data. But it seems cannot be applied to a > > sub-select result: > > As I seem to recall hav

[SQL] m4 macros plus PostgreSQL anyone?

2000-07-09 Thread andrew
little venture.  Any advice on that would be welcome too. ) Cheers, Andrew Smith --- /* rebuild user table tUsers */ ALTER TABLE tUsers RENAME TO tOldUsers; DROP SEQUENCE nUser; CREATE SEQUENCE nUser; CREATE TABLE tUsers (     kUser INTEGER NOT NULL DEFAULT NEXTVAL('nUser'),     fId TEX

Re: [SQL] using a self referencing table

2000-07-18 Thread andrew
[EMAIL PROTECTED] wrote: > i have a table with this structure > > name (varchar)|category id (int4)|parent category id (int4)|leaf node > (bool) > > im trying to make a perl script that should tree the info > > parent cat > subcat > subcat2 > subcat2 >

[SQL] Using a rule as a trigger.

2001-01-10 Thread Andrew Higgs
); CREATE SEQUENCE nextid start 1; CREATE RULE ins_topic AS ON INSERT TO topics WHERE id ISNULL DO UPDATE topics SET id=nextval('nextid') WHERE id ISNULL; This example updates the last insert. I need it to update the currnet insert. How do I do this? Kind regards Andrew Higgs

[SQL] "Subclassing" in SQL

2001-02-06 Thread Andrew Perrin
cause it's theoretically possible for me to change this conceptual relationship in the future. What I think I'm looking for is some sort of a join that will cause postgres to consider cd_pragmatic as True whenever cd_interest is true. Any thoughts? -----

Re: [SQL] Help retrieving lastest record

2001-02-16 Thread Andrew Perrin
imit 1; number | fruit | dt ++ 15 | Apples | 1999-07-20 00:00:00-05 (1 row) Cheers, Andy Perrin -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Soc

Re: [SQL] sum(bool)?

2001-02-23 Thread Andrew Perrin
Or how about just: SELECT count(*) FROM tablename WHERE a > b; -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin [EM

[SQL] create function w/indeterminate number of args?

2001-02-25 Thread Andrew Perrin
on. That is, sometimes I need minimum(arg1, arg2) but sometimes it's minimum(arg1, arg2, arg3, arg4, arg5), etc. Thanks- Andy Perrin ------ Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Caro

Re: [SQL] create function w/indeterminate number of args?

2001-03-02 Thread Andrew Perrin
',' || arg2 || ',' || arg3 || ',' || arg4 || ',' || > arg5) > > i.e.: > > create function minimum(text) returns integer > > and then do the parsing internally ('specially if you're using perl). > Pretty bad, but it's an opti

Re: [SQL] How do I use text script containing SQL?

2001-03-06 Thread Andrew Perrin
psql \i filename.txt -Andy Perrin "Jeff S." wrote: > > I want to build my tables by placing all the sql > statements in a file. What is the correct way to use > this file with psql? > > Example: My text file has this in it: > > CREATE TABLE table1 ( >table1_id serial, >field1 char(5

[SQL] recompiling to use gnu readline?

2001-03-10 Thread Andrew Perrin
thout wiping out existing data? Thanks. -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin [EMAIL PROTECTED] - [EMAIL PROT

[SQL] PL/PgSQL and NULL

2001-03-11 Thread Andrew Perrin
e returning 10. Can anyone offer advice? Thanks. ------ Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin [EMAIL PROTECTED] - [EMAIL PROTECTED

Re: [SQL] PL/PgSQL and NULL

2001-03-11 Thread Andrew Perrin
all entries are null. ------ Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin [EMAIL PROTECTED] - [EMAIL PROTECTED] On Sun, 11 Mar 2001, Ross J. Reeds

Re: [SQL] SQL Dummy Needs Help

2001-03-12 Thread Andrew Perrin
paidto_date; Again, untested - try it and see. -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill) [EMAIL PROTECTED] - http://www.unc.edu/~aperrin

Re: [SQL] Rule/currval() issue

2001-03-14 Thread Andrew Perrin
> > ---(end of broadcast)--- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html -- -- Andrew J. Perrin - Programmer/Analyst, Desktop Support Children's Primary Ca

Re: [SQL] creating "job numbers"

2001-03-22 Thread Andrew Perrin
INSERT in this session) Hope this helps. ------ Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill) [EMAIL PROTECTED] - http://www.unc.edu/~aperrin On Thu, 22 Mar 2001, postgresql wrote: > I have been

Re: [SQL] trigger output to a file

2001-03-23 Thread Andrew Perrin
ax you can get what you're looking for by simply JOINing Records and Data. Then, when you want to "change" a record - say, for example, Andrew Perrin moves from Berkeley to Chapel Hill, thereby changing phones from 510-xxx- to 919-xxx- - you actually *add* a new record, with a hi

[SQL] all views in database broken at once

2001-03-24 Thread Andrew Perrin
;t think I have the original SQL sitting around to drop and recreate them. Thanks for any advice. -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chap

Re: [SQL] all views in database broken at once

2001-03-24 Thread Andrew Perrin
h? Thanks again. ------ Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill) [EMAIL PROTECTED] - http://www.unc.edu/~aperrin On Sat, 24 Mar 2001

Re: [SQL] serial type; race conditions

2001-03-29 Thread Andrew Perrin
ELECT number_i_care_about FROM table WHERE serial_number = currval('serial_number_seq'); ap -- Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology (Soon: Asst Professor of Sociology, U of North Caroli

Re: [SQL] use of arrow keys to traverse history

2001-04-25 Thread Andrew Perrin
- > "Reality is that which, when you stop believing in it, doesn't go > away". > -- Philip K. Dick > > ---(end of broadcast)--- > TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] -- ---

Re: [SQL] Select most recent record?

2001-05-16 Thread Andrew Perrin
ff all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) -- -- Andrew J. Perrin - Programmer/Analyst, Desktop Support Children's Primary Care Research Group, UNC -

Re: [SQL] Case Insensitive Queries

2001-06-05 Thread ANDREW PERRIN
Try: - The ILIKE operator, for example, SELECT * FROM account WHERE username ILIKE "test"; - upper() or lower(), for example, SELECT * FROM accont WHERE lower(username) = "test"; ----- Andrew J. Perrin - Assistant Pr

Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Standards

2001-06-12 Thread ANDREW PERRIN
where name <> "bar"; returns 0 Cheers, Andy ----- Andrew J. Perrin - Assistant Professor of Sociology University of North Carolina, Chapel Hill 269 Hamilton Hall CB#3210, Chapel Hill, NC 27599-3210 USA [EMAIL PROTE

[SQL] simple recursive function in plpgsql fails

2002-06-13 Thread Andrew Hammond
erse('qwer'); reverse - rerq (1 row) Ooops... ---- Andrew G. Hammond [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> http://xyzzy.dhs.org/~drew/ <http://xyzzy.dhs.org/%7Edrew/> 56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481 5CD3 62B0 254B DEB1 86

Re: [SQL] is it easy to change the create sequence algorithm?

2002-06-21 Thread Andrew Hammond
Well, the quickest solution I can think of off hand is to not use SERIAL. Instead, do it manually, like this: DROP SEQUENCE my_seq; CREATE SEQUENCE my_seq; DROP TABLE my_table; CREATE TABLE my_table ( my_table_id INTEGER DEFAULT nextval('my_seq') PRIMARY KEY, ... ); Kevin Branne

[SQL] bytea etc.

2002-08-22 Thread Andrew Klimov
Hi , All!   Could someone clarify me  :   When I want to store BLOB's internally in database (for example jpeg ) should I use bytea or OID? Is OID something like BFILE in Oracle 8i?   If both are appropriate for internal BLOB why I can't use   update image set picture=lo_import('Myfile') where imag

[SQL] bytea ,etc.

2002-08-29 Thread Klimov Andrew
;) where image_code='blablabla' with bytea column type but only with OID column type?   And one more thing: Where is function byteain documented?   TIA, Andrew.

[SQL] LIMIT within UNION?

2002-09-12 Thread Andrew Perrin
. FROM participants WHERE typenr=2 LIMIT 172 ORDER BY zip; returns ERROR: parser: parse error at or near "ORDER" I've tried a variety of parentheses to no avail. Can someone shed some light? Thanks! ------ Andre

Re: [SQL] LIMIT within UNION?

2002-09-12 Thread Andrew Perrin
Thanks! That did it. The inner parens are necessary - without them the ORDER BY seems to be parsed as part of the second subquery and is therefore a syntax error. Best, Andy -- Andrew J Perrin - http://www.unc.edu/~aperrin

Re: [SQL] LIMIT within UNION?

2002-09-12 Thread Andrew Perrin
On 12 Sep 2002, Roland Roberts wrote: > >>>>> "Andrew" == Andrew Perrin <[EMAIL PROTECTED]> writes: > ... > Can you do this via a subselect: > > SELECT * FROM > ( SELECT ... FROM participants > WHERE typenr=1 AND > U

Re: [SQL] LIMIT within UNION?

2002-09-12 Thread Andrew Perrin
On Thu, 12 Sep 2002, Stephan Szabo wrote: > On Thu, 12 Sep 2002, Andrew Perrin wrote: > > > Greetings- > > > > I have a table of participants to be contacted for a study. Some are in > > the "exposure" group, others in the "control" group

[SQL] SQL formatter?

2002-09-25 Thread Andrew Perrin
FROM bar WHERE baz AND bop AND NOT boo ; Thanks, Andy -- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL PROTECTED] * andrew_perrin (at) un

Re: [SQL] SQL formatter?

2002-09-26 Thread Andrew Perrin
Unfortunately it is Windows based. The emacs mode for SQL is pretty primitive too. Oh well - maybe I'll write one someday. Thanks, Andy -- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology,

Re: [SQL] Case Sensitive "WHERE" Clauses?

2002-09-26 Thread Andrew Perrin
RE first_name ~* 'Jordan'; ap ------ Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL PROTECTED] * andrew_perrin (at) unc.edu On Thu, 26 Sep 2002, Jordan Reiter wrote: >

Re: [SQL] error...what to do?

2002-10-18 Thread Andrew Perrin
quot;. There's no column called "name". Try again with the line above as SELECT ffix_ability.ability_name ap -- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL PROTECTED] * andrew_perrin (at) unc.edu On Sat, 12

Re: [SQL] unnecessary updates

2002-10-30 Thread Andrew Perrin
changed in the object. Finally, there was an object method put() that took care of updating the database. put() checked the changed property and simply silently finished unless changed was true. ap ------ Andrew J Perrin - http://w

Re: [SQL] RFC: A brief guide to nulls

2003-01-15 Thread Andrew Perrin
for Jackie Smith, who would appropriately be represented by an entry in customers (, 'Jackie Smith') and one in cust_sexes (, NULL). (Otherwise the introduction is excellent.) Any comments? Andy -- Andrew J Perr

[SQL] "Best practice" advice

2003-01-17 Thread Andrew Perrin
referrals table: periph_id referring_id title referred_table authorreferred_id date page Comments? Thanks. ------ Andrew J Perrin - http://www.unc.edu/~aper

[SQL] Help with a query for charting

2003-02-01 Thread Andrew Veitch
day', date_opened) WHERE ; But it doesn't give me a zero for the days when no tickets were opened - which I really need because I want to graph the result. I could do this in the application code but that doesn't seem right. Help would be great. And

Re: [SQL] [NOVICE] For each record in SELECT

2003-02-01 Thread Andrew McMillan
an a zero, but your application should be able to handle that detail. You can also do this having two tables: one for the months, and another for the descriptions: SELECT * FROM months m CROSS JOIN descriptions d FULL OUTER JOIN values v ON m.month = v.month AND

Re: [SQL] [GENERAL] ALTER TABLE ... DROP CONSTRAINT

2003-07-31 Thread Andrew Gould
DAM - Technical Support > Analyst I performed that task yesterday using PostgreSQL 7.3.3: Alter table mkt drop constraint mkt_pkey; I don't know if it's supported in earlier versions. Best regards, Andrew Gould ---(end of broadcast)---

Re: [SQL] User-defined SQL function has slower query on 7.3.3 than

2003-08-14 Thread Andrew Droffner
t think that 7500 rows should never take over a minute. PG 7.3.3 takes 9 minutes (the one time we waited for it to finish). How many data pages could 7500 rows need? With 2 or 3 page reads, it can't take up much memory or I/O to do that. - Andrew On Wed, 6 Aug 2003, Tom Lane wrote: >

[SQL] User-defined SQL function has slower query on 7.3.3 than 7.1.3

2003-08-14 Thread Andrew Droffner
I have this QUERY (below) that PostgreSQL 7.3.X servers run MUCH slower than the 7.1.3 server does. It makes sense that both servers have to do a sequential scan over the ZIPCODE column. There are over 7,500 rows in the LOCATIONS table. Does anyone know what changed in the planner or optimizer? Can

Re: [SQL] [HACKERS] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Andrew Dunstan
to break lots of existing functions. Maybe the right thing would be to deprecate relying on implicit conversion to boolean for one release cycle and then make it an error. cheers andrew ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] Unique Constraint Based on Date Range

2003-09-20 Thread Andrew Milne
I'm looking to apply a unique constraint to a table such that field A must be unique based on the date range from Field B to Field C. This is for a rate based service model whereby, for example, $5 is worth 1 hour of Internet access. But next week, because of increased competition, $5 is wort

[SQL] Function ROWTYPE Parameter with NEW/OLD

2003-11-18 Thread Andrew Milne
ents); It cacks on the new and old parameters - misunderstanding on my part? potential bug? I have to check most of the fields in this table, so would rather pass the whole record rather than individual fields. Thanks, Andrew ---(end of broadcast)---

Re: [SQL] Trace for postgreSQL

2004-02-17 Thread Andrew Sullivan
Sure. Alter your configuration to echo queries, and then watch your log file. Alternatively, you can enable the command string statistics function, and then you get the queries in near to real time in pg_stat_activity. A -- Andrew Sullivan | [EMAIL PROTECTED] The plural of anecdote

Re: [SQL] pg_restore - don?t restore. Why?

2004-02-20 Thread Andrew Sullivan
On Fri, Feb 20, 2004 at 12:24:46AM -0300, 2000info wrote: > pg_dump, ok. > pg_restore, don?t restore. Why? If you didn't use a non-ASCII format from pg_dump, you don't need pg_restore. Just use psql. A -- Andrew Sullivan ---(

Re: [SQL] Import from Ms Excel

2004-03-16 Thread Andrew Sullivan
On Tue, Mar 16, 2004 at 03:13:38PM +0530, Kumar wrote: > Dear Friends, > > Is possible to import data from MS Excel sheet into postgres > database 7.3.4 running on Linux 7.2 Yes. I find the easiest way is to export a delimited file from Excel and use the \copy command in psql. A

Re: [SQL] Import from Ms Excel

2004-03-16 Thread Andrew Sullivan
this sort of thing, as you can easily run into its limitations. I suppose it depends on how big your resulting spreadsheets are going to be. In my experience, though, the first thing that happens when you deliver someone a summary spreadsheet is, they ask you for the raw data so they can doubl

Re: [SQL] conversion of postgres database to oracle

2004-03-16 Thread Andrew Sullivan
On Tue, Mar 16, 2004 at 02:13:57PM +0200, cristi wrote: > How should I convert a postgres database to oracle? Send it out to ASCII and then import it to Oracle. But if you want support for going _to_ Oracle, you probably ought to get support from Oracle people, right? A -- Andrew Sulli

Re: [SQL] transaction

2004-04-21 Thread Andrew Sullivan
On Tue, Apr 20, 2004 at 09:14:48PM +0200, H.J. Sanders wrote: > > - BEGIN WORK > > - INSERT ROW > > - IF FAILED THEN UPDATE ROW > > - COMMIT WORK You can do it the other way. Begin, update; if 0 rows are updated then insert. A -- Andrew Sull

Re: [SQL] EXPORT / IMPORT

2004-05-07 Thread Andrew Sullivan
n). pg_dump -d or -D. Note that restoring from this is going to be a whole lot slower than restoring from a COPY based dump. A -- Andrew Sullivan | [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please s

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-06 Thread Andrew Sullivan
ages, then you can end up with references in the database to files that don't exist, because the filesystem operations can't be made subject to the transactions of the database. A -- Andrew Sullivan | [EMAIL PROTECTED] ---(end of broadcast)---

Re: [SQL] typecasting numeric(18,4) to varchar/text

2004-05-04 Thread Andrew Sullivan
a (a numeric(18,4)); CREATE TABLE andrewtest=# create table b (b varchar(25)); CREATE TABLE andrewtest=# insert into a values(12000.43); INSERT 17168 1 andrewtest=# insert into b select (a.a)::varchar; INSERT 17169 1 That's on 7.4.2. You might want to try casting to text first. A -- And

Re: [SQL] view running query

2004-05-17 Thread Andrew Hammond
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 There are two ways to do it. The server-side approach is to increase logging levels in the config file and then "pg_ctl reload". See http://www.postgresql.org/docs/7.4/interactive/runtime-config.html#RUNTIME-CONFIG-LOGGING for the stuff involved. The ot

Re: [SQL] feature request ?

2004-06-24 Thread Andrew Sullivan
On Thu, Jun 24, 2004 at 12:32:59PM -0500, Jaime Casanova wrote: > > Why not disallow the ability of boolean fields to be null? Why not do it yourself? That's what the NOT NULL constraint is for. A -- Andrew Sullivan | [EMAIL PROTECTED] I remember when computers were frustrat

[SQL] Complicated "group by" question

2004-08-25 Thread Andrew Perrin
assign_id ... assign_date ... ... Thanks for any guidance. Andy ------ Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL

Re: [SQL] Complicated "group by" question

2004-08-25 Thread Andrew Perrin
Excellent - thanks, Josh! -- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL PROTECTED] * andrew_perrin (at) unc.edu On Wed, 25 Aug 2004, Josh Berkus wrote

Re: [SQL] Preserving column order when recreating table.

2004-09-15 Thread Andrew Sullivan
names to get everything in the order you like, of course), and then rename the old table, rename the new table to the old table name, and drop the old table if you like. A -- Andrew Sullivan | [EMAIL PROTECTED] The fact that technology doesn't work is no bar to success in the market

Re: [SQL] Preserving column order when recreating table.

2004-09-15 Thread Andrew Sullivan
On Wed, Sep 15, 2004 at 04:22:01PM +0200, Stef wrote: > Andrew Sullivan mentioned : > => I'm not sure why you want to do the former, but in any case, it's > Because lazy people write inserts without specifying column names. Ugh. Sorry to say so, but this sounds to me real

Re: [SQL] Preserving column order when recreating table.

2004-09-15 Thread Andrew Sullivan
why I didn't use this solution originally. But I figured out a way to > modify pieces of the "create table" statement to drop all the indexes > and constraints first. > > Is there an easier way around this? I doubt it. A -- Andrew Sullivan

Re: [SQL] How to check postgres running or not ?

2004-09-19 Thread Andrew Sullivan
On Sun, Sep 19, 2004 at 12:25:00PM -0400, Tom Lane wrote: > ps aux | grep postmaster | grep -v grep > (or use "ps -ef" if using a SysV-ish ps). Except that on Solaris, ps -ef _always_ shows "postmaster", even for the individual back ends. A -- Andrew Sullivan

Re: [SQL] How to check postgres running or not ?

2004-09-19 Thread Andrew Sullivan
se, on Solaris you also have the ucb ps, so it makes no difference.) A -- Andrew Sullivan | [EMAIL PROTECTED] The fact that technology doesn't work is no bar to success in the marketplace. --Philip Greenspun ---(end of broadcast)--

Re: [SQL] CREATE TABLE AS SELECT....

2004-09-20 Thread Andrew Hammond
TER TABLE a SET srl NOT NULL; ALTER TABLE a SET login_name NOT NULL; ALTER TABLE a SET password NOT NULL; I'll just assume that you're using hased passwords, and not storing them in cleartext... - -- Andrew Hammond416-673-4138[EMAIL PROTECTED] Database Admi

[SQL] SQL confusion

2004-10-09 Thread Andrew Ward
me looping in the Perl script, but I'd like to avoid pulling the whole list into memory in case the list gets long. My preference is to just handle one record at a time in Perl if possible. Help? Andrew Ward [EMAIL PROTECTED] __ Do You Ya

Re: [SQL] JOIN not being calculated correctly

2004-11-02 Thread Andrew Hammond
ated. I've taken it as far as I can and don't really know where to | move from here. - -- Andrew Hammond416-673-4138[EMAIL PROTECTED] Database Administrator, Afilias Canada Corp. CB83 2838 4B67 D40F D086 3568 81FC E7E5 27AF 4A9A -BEGIN PGP SIGNATURE- Version: GnuPG

Re: [SQL] vacuum analyze slows sql query

2004-11-03 Thread Andrew Sullivan
ooking for locks here, though. That makes no sense, given that you've only 78 rows being returned. BTW, this topic should probably be better pursued on -performance. A -- Andrew Sullivan | [EMAIL PROTECTED] I remember when computers were frustrating because they *did* exactly what y

Re: [SQL] vacuum analyze slows sql query

2004-11-03 Thread Andrew Sullivan
don't know if you looked at my stored function, but there are > no locks in it (no explicit ones anyway). Foreign keys are one well-known area of locking surprises. A -- Andrew Sullivan | [EMAIL PROTECTED] This work was visionary and imaginative, and goes to show that visio

Re: [SQL] Move table between schemas

2004-11-16 Thread Andrew Sullivan
le oughta work. A -- Andrew Sullivan | [EMAIL PROTECTED] When my information changes, I alter my conclusions. What do you do sir? --attr. John Maynard Keynes ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ?

Re: [SQL] Move table between schemas

2004-11-16 Thread Andrew Sullivan
#x27;m afraid. I don't know of a way to move tables from one schema to another otherwise. You could do all the dependencies with a pg_dump -t, I suspect. Not tested that, though. A -- Andrew Sullivan | [EMAIL PROTECTED] A certain description of men are for getting out of debt, yet are

Re: [SQL] NULLS and string concatenation

2004-11-23 Thread Andrew Hammond
'' || $2, $2);' LANGUAGE sql; CREATE AGGREGATE comma_concat ( ~BASETYPE=text, ~SFUNC=comma_concat, ~STYPE=text ); Which is handy for 1:n reports like SELECT grade, comma_concat($name) AS members FROM test_results GROUP BY grade; - -- Andrew Hammond416-673-4138[EMAIL

[SQL] HowTo change encoding type....

2004-11-25 Thread Andrew M
Hi, how do I change the encoding type in postgreSQL (8) from UTF-8 to ISO-8859-1? many thanks Andrew <>  +The home of urban music + http://www.beyarecords.com ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Type Inheritance

2004-11-25 Thread Andrew Thorley
Does anyone know how to implement type inheritance in postgresql? in oracle you just use the word UNDER in ur code i.e: CREATE TYPE test2_UDT UNDER test1_UDT AS (abc INT); any ideas? -- __ Check out the latest SMS services @ http://www.linuxmail.org

[SQL] tutorials for complex.sql & complex.c

2004-11-26 Thread Andrew Thorley
hi can anyone inform me where to get the postgreSQL complex.sql & complex.c tutorials from, cos i have no idea. in the 7.4.2-A4 doc it says: The examples in this section can be found in complex.sql and complex.c in the src/tutorial directory of the source distribution. See the README file in th

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Andrew Sullivan
gt; thing, though I understand they would run recursively too. Here's the > table structure in question: You have to do this with a trigger. The problem is that the rule is expanded inline like a macro, so you can't prevent the behaviour you're seeing. A -- Andrew Sullivan

Re: [SQL] Way to stop recursion?

2004-11-26 Thread Andrew Sullivan
ly in the parent. Tom's answers always make me realise that I should think harder before I talk. He's right, of course: one common value means store it once. A -- Andrew Sullivan | [EMAIL PROTECTED] I remember when computers were frustrating because they *did* exactly what you told th

Re: [SQL] Type Inheritance

2004-11-27 Thread Andrew Thorley
t; <[EMAIL PROTECTED]> To: "Andrew Thorley" <[EMAIL PROTECTED]> Subject: Re: [SQL] Type Inheritance Date: Fri, 26 Nov 2004 13:14:07 -0500 > > "Andrew Thorley" <[EMAIL PROTECTED]> writes: > > Does anyone know how to implement type inheritance in postg

Re: [SQL] Type Inheritance

2004-11-27 Thread Andrew Thorley
is is what im trying to achieve, although at present, to no avail :( - Original Message ----- From: "Andrew Thorley" <[EMAIL PROTECTED]> To: "Tom Lane" <[EMAIL PROTECTED]> Subject: Re: [SQL] Type Inheritance Date: Sat, 27 Nov 2004 22:04:55 +0800 > > hi

[SQL] inserting values into types

2004-11-30 Thread Andrew Thorley
Hi, ive generated a user defined type: CREATE TYPE qwerty_UDT AS (abc INT); & table as: CREATE TABLE t (col1 qwerty_UDT); my prob is that when i try to insert into the type i.e: INSERT INTO t (col1) Values (qwerty_UDT(123)); i get the error: ERROR: function test_x(integer) does not exist HIN

Re: [SQL] inserting values into types

2004-12-01 Thread Andrew Thorley
qwerty_udt(integer) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. - Original Message - From: "Michael Fuhr" <[EMAIL PROTECTED]> To: "Andrew Thorley" <[EMAIL PROTECTED]> Subject: Re: [SQL]

Re: [SQL] find the "missing" rows

2004-12-02 Thread Andrew - Supernews
#x27;t succeed since the b.n = 'b' condition is guaranteed to fail > when b.* is nulled out ... You can make it work by moving parts of the condition into the explicit join clause: select a.i from t as a left join t as b on a.n='a' and b.n='b' and a.i=b.i whe

[SQL] Failed system call was shmget(key=1, size=1155072, 03600).

2004-12-03 Thread Andrew M
size (currently 1155072 bytes), reduce PostgreSQL's shared_buffers parameter (currently 50) and/or its max_connections parameter (currently 10) What is the best way to resolve this? max_connections = 10? Does that figure auto increase as more users request data? rega

Re: [SQL] Failed system call was shmget(key=1, size=1155072, 03600).

2004-12-03 Thread Andrew Sullivan
On Fri, Dec 03, 2004 at 09:00:53AM +, Andrew M wrote: > DETAIL: Failed system call was shmget(key=1, size=1155072, 03600). > HINT: This error usually means that PostgreSQL's request for a shared > memory segment exceeded available memory or swap space. To reduce the

Re: [SQL] sum query

2004-12-04 Thread Andrew - Supernews
IN in place of a join is unwise (even though recent versions can sometimes plan it as though it were a join); using UNION in place of an outer join is _very_ unwise. (In fact UNION / INTERSECT / EXCEPT should normally be reserved for those cases where there is simply no alternative.) -- Andrew, S

Re: [SQL] Breadth first traversal in PLSQL (How to implement Queue?)

2004-12-15 Thread Andrew - Supernews
Now I > need help porting the "down" the hierarchy function. Have you looked at contrib/tablefunc's connectby() function? -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services ---(end of broadcast)-

Re: [SQL] Implementing queue semantics (novice)

2005-01-12 Thread Andrew Hammond
nal | 'processed' timestamp-column? | | | | Thanks for helping me do the right. | | ---(end of broadcast)--- | TIP 4: Don't 'kill -9' the postmaster - -- Andrew Hammond416-673-4138[EMAIL PROTECTED] Database Admin

Re: [SQL] failed to find conversion function from "unknown" to text

2005-01-12 Thread Andrew Sullivan
ELECT case 'a'::text. . .) A -- Andrew Sullivan | [EMAIL PROTECTED] Information security isn't a technological problem. It's an economics problem. --Bruce Schneier ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Syntax error while altering col-type

2005-01-13 Thread Andrew Sullivan
f decisions that need to be made about what to do with incompatible types. What if you change from int8 to int4? What about varchar(4) to char(4)? Just to name two simple-minded examples. See the -general and -hackers archives for plenty of previous discussion of this stuff. A -- Andrew Su

  1   2   3   4   >