Re: [SQL] Porting application with rules and triggers from PG 7.4.x to 8.1.3

2006-04-21 Thread Tom Lane
Andreas Haumer [EMAIL PROTECTED] writes: How can I get the functionality of an deferred AFTER trigger again with PostgreSQL 8? Use CREATE CONSTRAINT TRIGGER. The manual is fairly negative about this but I don't actually foresee it going away any time soon. regards, tom

Re: [SQL] Field length ??

2006-04-20 Thread Tom Lane
(n) *is* a variable-length type, not merely handled as such, because the limit N is measured in characters not bytes. To support variable-length encodings such as UTF8 we have to treat it as variable length. regards, tom lane ---(end of broadcast

Re: [SQL] At time zone madness!

2006-04-20 Thread Tom Lane
ZONE has the effect of specifying what the stored timestamp really means, and the second does the rotation to London time. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your

Re: [SQL] concatenation with a null column (using ||) nulls the result?

2006-04-10 Thread Tom Lane
, respectively. a) If either S1 or S2 is the null value, then the result of the concatenation is the null value. ... regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your

Re: [SQL] Special meaning of NL string

2006-04-10 Thread Tom Lane
'BE' in your table ... the planner does examine statistics while deciding what sort of scan to use. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] How to copy data between joined columns?

2006-04-07 Thread Tom Lane
prefer to code it using sub-selects. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Reverse Index ... how to ...

2006-04-05 Thread Tom Lane
) regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] SELECT composite type

2006-04-05 Thread Tom Lane
(SELECT get_xy(SetSRID(sightings.location, 26910), 4326) AS foo, sightings.title FROM sightings WHERE sighting_id = 25 OFFSET 0) bar; There are some other features such as DISTINCT that also prevent flattening, but there seems no call for that here. regards, tom lane

Re: [SQL] problem comparing strings when different cluster / database encoding

2006-04-05 Thread Tom Lane
expectations. We'd forbid these combinations if there were any fully portable way to detect which encoding the locale expects... regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] query; check for zero and floats

2006-03-31 Thread Tom Lane
want SELECT SUM(x0 + y0 + z0)::float / SUM(x2 + y2) AS A1, SUM(x1 + y1 + z1)::float / SUM(x3 + y3) AS A2 FROM test HAVING SUM(x2 + y2) 0 (maybe also having SUM(x3 + y3) 0) regards, tom lane ---(end of broadcast

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread Tom Lane
list, rather than extend it. It's weird and not very semantically sound --- in particular, there's no very sensible definition if there's more than one of them in the target list. See past discussions in the PG archives. regards, tom lane ---(end

Re: [SQL] Custom type

2006-03-24 Thread Tom Lane
a bit like a bug to me... No, because that Description column is for comments on the individual columns. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http

Re: [SQL] Find min and max values across two columns?

2006-03-24 Thread Tom Lane
), min(columnB)) from tab; greatest/least are relatively new but you can roll your own in older PG releases. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire

Re: [SQL] Find min and max values across two columns?

2006-03-24 Thread Tom Lane
from tab; Just for the record, we've gotten that right since 7.4. greatest() would be a notationally cleaner solution than CASE, but multiple occurrences of identical aggregates don't cost much of anything. regards, tom lane ---(end of broadcast

Re: [SQL] Index on nullable column

2006-03-24 Thread Tom Lane
. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] COPY tablename FROM and null values

2006-03-22 Thread Tom Lane
, unless the file is set up so that the second TAB is missing when column3 is empty. If so, you'll need to fix that. COPY is going to complain if there aren't exactly two TABs on every line. regards, tom lane ---(end of broadcast

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Tom Lane
using EXECUTE. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] OUT parameter

2006-03-22 Thread Tom Lane
parameters and are unlikely to start doing so. There isn't any way that you can affect locals of a calling procedure before you return. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Function Parameters in GROUP BY clause cause errors

2006-03-22 Thread Tom Lane
symbol (notice they are not in the regurgitated query). It would be more efficient anyway to not generate multiple parameters for the same value, so we oughta fix this. Patch applied to HEAD and 8.1 branches. regards, tom lane ---(end

Re: [SQL] have you feel anything when you read this ?

2006-03-20 Thread Tom Lane
processing of \000 happens somewhere further downstream, and wouldn't be affected.) regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your

Re: [SQL] update before drop causes OID problems in transaction?

2006-03-17 Thread Tom Lane
involving the dropped table, but your description doesn't mention either of those risk factors. regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http

Re: [SQL] update before drop causes OID problems in transaction?

2006-03-17 Thread Tom Lane
before 8.2 at the earliest. In the meantime I'm wondering why you are insistent on dropping and recreating credit_card_audit, as opposed to something less invasive like TRUNCATE. regards, tom lane ---(end of broadcast)--- TIP 5

Re: [SQL] update before drop causes OID problems in transaction?

2006-03-17 Thread Tom Lane
Jeff Frost [EMAIL PROTECTED] writes: On Sat, 18 Mar 2006, Tom Lane wrote: No, I think it's that you've got a plpgsql trigger function that contains queries referring to credit_card_audit. Dropping and recreating that table invalidates plpgsql's cached plans for those queries

Re: [SQL] About how to use exception when ??? then

2006-03-16 Thread Tom Lane
Emi Lu [EMAIL PROTECTED] writes: Should I install any patches or do anything elese to have SQLSTATE and SQLERRM work for me? Update to 8.1 ... regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our

Re: [SQL] group by function, make SQL cleaner?

2006-03-15 Thread Tom Lane
version of the spec but we allow it anyway. I'm not sure how common that notation is. This does not work in any context except repeating a SELECT result expression in GROUP BY or ORDER BY. regards, tom lane ---(end of broadcast

Re: [SQL] Set generating functions and subqueries

2006-03-13 Thread Tom Lane
Markus Schaber [EMAIL PROTECTED] writes: Tom Lane wrote: The fact that the other form is even allowed is more of a holdover from PostQUEL than something we have consciously decided is a good idea. (IMHO it's actually a fairly *bad* idea, because it does not work nicely when there's more than

Re: [SQL] Permission to Select

2006-03-13 Thread Tom Lane
privilege to be needed. If we had per-column privileges then we could be finer-grained about it, but we don't (yet). Please examine the following patch and make your judgment: This patch is so wrong it's not even worth discussing :-( regards, tom lane

Re: [SQL] removing not null modifier

2006-03-13 Thread Tom Lane
himself off 7.2.2 ASAP. Some of them can be found here: http://developer.postgresql.org/docs/postgres/release.html regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http

Re: [SQL] Set generating functions and subqueries

2006-03-10 Thread Tom Lane
the functionality. I seem to recall speculating that SQL2003's LATERAL tables might do the job. Btw, having several set-returning functions with equal or different set lengths produce interesting results: No kidding. regards, tom lane ---(end

Re: [SQL] Problems with disabling triggers in Postgres 7.3.9

2006-03-09 Thread Tom Lane
with a given name; there needs to be some thought about schemas here. In general though I agree with Alvaro's comment that touching system catalogs directly is bad practice. You should update to a PG version that has ALTER TABLE DISABLE TRIGGER, and use that. regards, tom lane

Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread Tom Lane
Scott Marlowe [EMAIL PROTECTED] writes: For same reasons, i.e. a need for precision, I find it hard to accept the idea of mixing positive and negative units in the same interval. The semantics are perfectly well defined, so I don't buy this. regards, tom lane

Re: [SQL] [GENERAL] Errors ignored on restore

2006-03-08 Thread Tom Lane
, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] [GENERAL] problem with overloading the coalesce function

2006-03-06 Thread Tom Lane
Richard Huxton dev@archonet.com writes: Hmm - looking at the source (and \df in psql) it seems the basic problem is that COALESCE() isn't a function. If it were an ordinary function, it couldn't satisfy the property of not evaluating unused arguments ... regards, tom

Re: [SQL] functions in WHERE clause

2006-03-05 Thread Tom Lane
. regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Help with distinctly non-intuitive rule behaviour

2006-03-05 Thread Tom Lane
, the delete is still run, with the added where-condition NOT(user_departed now()). Since the UPDATE has caused that to be true, the delete happens. You should reconsider whether this is to be conditional or not. regards, tom lane ---(end of broadcast

Re: [SQL] how to make infinite intervals?

2006-03-03 Thread Tom Lane
to it. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] Getting yyyy-mm-dd 00:00:00 in an arbitrary time zone

2006-03-03 Thread Tom Lane
? regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] dump with lo

2006-03-02 Thread Tom Lane
. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Tom Lane
with different signs for month and day (except for the case with month = 0, per my last message). regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Change date format through an environmental variable?

2006-03-01 Thread Tom Lane
, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Index to support LIKE '%suffix' queries

2006-02-25 Thread Tom Lane
at tsearch2? regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] After Trigger assignment to NEW

2006-02-24 Thread Tom Lane
Achilleus Mantzios [EMAIL PROTECTED] writes: Is there a reason that the NEW values should remain unchanged in AFTER row triggers? By definition, an AFTER trigger is too late to change what was stored. Use a BEFORE trigger. regards, tom lane

Re: [SQL] After Trigger assignment to NEW

2006-02-24 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Tom Lane wrote: Achilleus Mantzios [EMAIL PROTECTED] writes: Is there a reason that the NEW values should remain unchanged in AFTER row triggers? By definition, an AFTER trigger is too late to change what was stored. Use a BEFORE trigger

Re: [SQL] 'locking' the SELECTs based on indices...

2006-02-22 Thread Tom Lane
, it's a bug; please provide a reproducible test case. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes

Re: [SQL] Interval subtracting

2006-02-18 Thread Tom Lane
that are = 30 days. However, I think a good case could be made that it should normalize negative days too; that is, the invariant on its result should be 0 = days 30, not merely days 30. Similarly for justify_hours. Comments anyone? Patch anyone? regards, tom lane

Re: [SQL] two count columns?

2006-02-17 Thread Tom Lane
(*) from log where from_ip = logouter.from_ip) ... from log logouter ... Note that anything like this is going to be pretty expensive if your log table is large. You might want to think about something involving another layer of GROUP BY instead. regards, tom lane

Re: [SQL] VIEWs and TEMP tables problem

2006-02-16 Thread Tom Lane
the permanent view in the same way as the temp table hides the permanent table). regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Tom Lane
of the index if EVENT_NAME is first, but not if EVENT_DATE_CREATED is first. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Tom Lane
maybe not such a good idea in a live environment ... but then again, dropping useful indexes in a live environment isn't a good idea either, and this at least reduces the duration of the experiment by a good deal. regards, tom lane ---(end

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Tom Lane
(and the system knows it, note the huge cost estimate). Try increasing work_mem enough so you get a hashed subplan instead. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] create table and data types

2006-02-14 Thread Tom Lane
--- there are syntactic conflicts with allowing it in general, but I'm not sure that objection applies to table declarations. But it's not there today. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Problems with distinct

2006-02-13 Thread Tom Lane
in your first example are a no-op. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] Very slow updates when using IN syntax subselect

2006-02-11 Thread Tom Lane
Bryce Nesbitt [EMAIL PROTECTED] writes: Tom Lane wrote: What does EXPLAIN show for this and for the base query? - Seq Scan on event (cost=0.00..0.00 rows=1 width=408) Filter: (reconciled = false) select count(*) from event; --- 116226 It seems pretty clear

Re: [SQL] Very slow updates when using IN syntax subselect

2006-02-11 Thread Tom Lane
of the involved tables. It's also less than polite to complain about the behavior of two-year-old releases, without making any effort to ascertain whether more-current versions are smarter. regards, tom lane ---(end of broadcast

Re: [SQL] date

2006-02-10 Thread Tom Lane
be of use, particularly on the input side. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do

Re: [SQL] Very slow updates when using IN syntax subselect

2006-02-10 Thread Tom Lane
://developer.postgresql.org/docs/postgres/release.html regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do

Re: [SQL] unique constraint instead of primary key? what disadvantage(ODBC usage)?

2006-02-09 Thread Tom Lane
doesn't; you can make a FOREIGN KEY reference to a column that's only UNIQUE, but you'll always have to specify which column. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map

Re: [SQL] UNIQUE, btree index allows duplicate records, if some fields are null

2006-02-09 Thread Tom Lane
records where other_thing is null, they all go in without complaint. I can insert as many duplicates as I want. This is per SQL spec. You're imagining that two nulls are considered equal, which they are not. regards, tom lane ---(end of broadcast

Re: [SQL] trecherous subselect needs warning?

2006-02-07 Thread Tom Lane
, or at least a warning, not just an empty rowset. Access to upper-level variables from subqueries is (a) useful and (b) required by the SQL spec, so we are not going to start throwing warnings about it. regards, tom lane ---(end of broadcast

Re: [SQL] trecherous subselect needs warning?

2006-02-07 Thread Tom Lane
where it would fit in the manual. Perhaps some sort of SQL gotchas webpage on techdocs would be appropriate. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http

Re: [SQL] UnixODBC-2.2.8-2.3.0 driver

2006-02-04 Thread Tom Lane
Philly Mandiza [EMAIL PROTECTED] writes: Driver=/usr/lib/psqlodc.so Perhaps you meant psqlodbc.so ? regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http

Re: [SQL] CREATE INDEX with order clause

2006-02-01 Thread Tom Lane
Daniel Caune [EMAIL PROTECTED] writes: I would like to create an index on a table, specifying an order clause for one of the columns. Search the archives for discussions of reverse-sort operator classes (you might also get hits on the shorthand opclass). regards, tom

Re: [SQL] Function with default value?

2006-01-29 Thread Tom Lane
) ... CREATE OR REPLACE FUNCTION foo(i IN int) ... return foo(i, 1) ... Remember that PG lets you overload a function name by using the same name with different parameter lists. regards, tom lane ---(end of broadcast)--- TIP 9

Re: [SQL] filtering after join

2006-01-27 Thread Tom Lane
. (If you ever got it to work, which I doubt you will, you'd probably then start to notice how badly it leaks memory for whole-row operations...) You should either forget this idea or invest the effort to move up to PG 8.1. regards, tom lane ---(end

Re: [SQL] [HELP] Defining a function as a procedure

2006-01-26 Thread Tom Lane
Daniel Caune [EMAIL PROTECTED] writes: Is there a way to define a function as a procedure, I mean a function that returns nothing. In recent versions you can say RETURNS VOID, which is a bit of a hack but it gets the point across... regards, tom lane

Re: [SQL] How to implement Microsoft Access boolean (YESNO)

2006-01-24 Thread Tom Lane
version I have alive to check) been able to write '0' or '1' as the input textual representation of bool. The latter has nothing to do with any integer coercion though. regards, tom lane ---(end of broadcast)--- TIP 2: Don't

Re: [SQL] pgadmin

2006-01-23 Thread Tom Lane
reasonable to be using today. Anyway, no this is not the right list for asking for build help for pgadmin. Try pgadmin-support, or maybe pgadmin-hackers. regards, tom lane ---(end of broadcast)--- TIP 1: if posting/reading

Re: [SQL] How to implement Microsoft Access boolean (YESNO)

2006-01-23 Thread Tom Lane
easily in prior releases ... regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] How to implement Microsoft Access boolean (YESNO) fieldtype in PostgreSQL ?

2006-01-22 Thread Tom Lane
is 't' and 'f', though. Otherwise you'll need to make the domain be over a type with suitable I/O format (perhaps integer or text will work). regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner

Re: [SQL] What does merge-joinable join conditions mean ????

2006-01-15 Thread Tom Lane
!= 0; regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] What does merge-joinable join conditions mean ????

2006-01-15 Thread Tom Lane
to make it seem like a high-priority problem, however. I can only recall one or two people complaining about it in all the time we've had outer-join support. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below

Re: [SQL] What does merge-joinable join conditions mean ????

2006-01-15 Thread Tom Lane
) are removed, the SELECT functions (does not give an error message), Really? The FULL JOIN condition using ~ is the source of the failure, and I'd be quite surprised if changing WHERE makes it work. regards, tom lane ---(end of broadcast

Re: [SQL] What does merge-joinable join conditions mean ????

2006-01-15 Thread Tom Lane
and right joins seems the only very reasonable solution. As long as you're sure there are no duplicate rows you need to keep, it'll work well enough. regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list

Re: [SQL] select and as doubt

2006-01-14 Thread Tom Lane
=?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= [EMAIL PROTECTED] writes: It's possible to make an SELECT inside an AS clause ? No. You could try building the query as a string. regards, tom lane ---(end of broadcast

Re: [SQL] ORDER BY does not work as expected with multiple joins

2006-01-13 Thread Tom Lane
. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] foreign keys with on delete cascade and triggers

2006-01-12 Thread Tom Lane
Dirk Jagdmann [EMAIL PROTECTED] writes: Now I'd like to know if the current order of deletions in PostgreSQL is intended in the top-down way or if that could be changed? Sorry, I don't see much chance of changing it. regards, tom lane ---(end

Re: [SQL] info is a reserved word?

2006-01-12 Thread Tom Lane
as a keyword outside the context where the keyword is meaningful. This could probably be fixed, or at least greatly reduced, with some flex/bison hacking. Anyone up for it? regards, tom lane ---(end of broadcast)--- TIP 4: Have

Re: [SQL] Unable to identify an ordering operator '' for type 'smallint[]'

2006-01-11 Thread Tom Lane
to 8.1. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] foreign keys with on delete cascade and triggers

2006-01-11 Thread Tom Lane
discussed before ... see the archives.) regards, tom lane ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message

Re: [SQL] system view corrupted, i get unexpected right parenthesis for many system tables.

2006-01-09 Thread Tom Lane
that you created after changing ... regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] system view corrupted, i get unexpected right parenthesis for many system tables.

2006-01-09 Thread Tom Lane
the end of the string.) If you delete the field (text :fieldname ) from the non-working ev_action strings you should be able to get to a state where all the views will dump in a non-hier build. regards, tom lane ---(end of broadcast

Re: [SQL] INSERT waiting under heavy load

2006-01-06 Thread Tom Lane
for those counters. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] INSERT waiting under heavy load

2006-01-06 Thread Tom Lane
.) regards, tom lane ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] FOREIGN KEYs ... I think ...

2006-01-04 Thread Tom Lane
your schema correctly). regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] avg() with floating-point types

2006-01-01 Thread Tom Lane
precision than that. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Tom Lane
, assigning to an element of a NULL array left the array still NULL --- this is an artifact of the fact that the system sees the assignment as a binary operation with the array and the new element as inputs. regards, tom lane ---(end of broadcast

Re: [SQL] Cursors and recursion

2005-12-28 Thread Tom Lane
a particular session. IIRC there is a syntax for opening a cursor without specifying a name, in which case plpgsql will pick one that's not in use. This is probably what you want to use. regards, tom lane ---(end of broadcast

Re: [SQL] DISTINCT with NULLs and INT fields

2005-12-28 Thread Tom Lane
without complaint. You might as well not have a type system at all, if you're going to destroy its ability to detect mistakes that way. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner

Re: [SQL] DISTINCT with NULLs and INT fields

2005-12-28 Thread Tom Lane
a type choice, so that the INSERT sees the raw untyped values, but I think that this query is probably illegal per spec --- I believe the spec requires a SELECT to deliver well-defined data types. Too lazy to go look up chapter and verse at the moment. regards, tom lane

Re: [SQL] Help with simple query

2005-12-28 Thread Tom Lane
reports example in the SELECT reference page. If you want to stick to portable SQL, you can still do it, but it's pretty ugly and slow. Look in the list archives for previous discussions. regards, tom lane ---(end of broadcast

Re: [SQL] DISTINCT with NULLs and INT fields

2005-12-28 Thread Tom Lane
). But it seems people expect to be able to do things like number || ' string' without explicitly casting the number to text. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] large IN/NOT IN subqueries result in query returning wrong data

2005-12-27 Thread Tom Lane
of t1 has a NULL value of name. Many people find the behavior of NOT IN with nulls unintuitive, but it's per SQL spec ... regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ

Re: [SQL] large IN/NOT IN subqueries result in query returning wrong data

2005-12-27 Thread Tom Lane
); ?column? -- f (1 row) regression=# select 3 in (NULL, 1, 2); ?column? -- (1 row) regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http

Re: [SQL] Querying date_time for date only ?

2005-12-20 Thread Tom Lane
mytable; The date_trunc() function can also be useful for this sort of thing, particularly if you need to round off to something finer or coarser than days. http://www.postgresql.org/docs/8.1/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC regards, tom lane

Re: [SQL] Sub-query as function argument

2005-12-20 Thread Tom Lane
)); This is generally true everywhere in expressions, not just in function arguments. Without the parens, it's often ambiguous what's subselect and what's outer query. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-19 Thread Tom Lane
Andrew Sullivan [EMAIL PROTECTED] writes: On Sun, Dec 18, 2005 at 10:08:22PM -0500, Tom Lane wrote: Just for the record, that behavior is seriously broken: it violates MVCC if any of the deleted tuples are still visible to anyone else. Does it remove tuples that VACUUM FULL wouldn't? Yes

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Tom Lane
for quite a few view-rewriting scenarios, mainly because you'd avoid all the gotchas with double evaluation and so on. So it seems like it might be worth doing. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-18 Thread Tom Lane
. regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Defaulting a column to 'now'

2005-12-14 Thread Tom Lane
be spelled without parentheses); the traditional Postgres way is now() Either way only sets an insertion default, though. If you want to enforce a correct value on insertion, or change the value when the row is UPDATEd, you need to use a trigger. regards, tom lane

Re: [SQL] lo function changed in PostgreSQL 8.1.1

2005-12-13 Thread Tom Lane
? regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

<    3   4   5   6   7   8   9   10   11   12   >