le this could
probably be fixed with some effort, I doubt it's going to happen soon.
Is there any chance of doing what you want with a trigger instead of a
rule?
regards, tom lane
---(end of broadcast)---
TIP 2
result).
> Is there a way to rewrite the query as a view such
> that one can do:
I'm really not clear on what you want here. Better example please?
regards, tom lane
---(end of broadcast)---
TIP 3: if po
e I don't see why you're bothering.
If the sub-SELECT can be flattened, the planner will generally do
it for you. I'd expect the first form of the query to give the
same plan (in pre-7.4 releases, maybe even a better plan) as the
second.
Perhaps you're showing us an oversim
formation that's stored in the first page of a btree index wasn't
right.
How exactly did you "shut down the server"? Have you noticed any other
evidence of disk problems, outside Postgres?
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
> daten) d2) as foo using (number);
> ERROR: ExecEvalExpr: unknown expression type 108
7.3 has a problem with subselects referenced as join outputs. There is
a fix in 7.3.1, and a better fix in place for 7.4.
regards, tom lane
---(end of broa
12/msg00375.php
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
SEQUENCE command in CVS tip, though I'm not sure
I trust it in concurrent-usage scenarios :-(
regards, tom lane
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
ry it again with a combination like
export LANG=cs_CZ
export LC_MESSAGES=C
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
;t work in 7.2.*. The fix is not practical to
back-port, so you're stuck: either modify the query to avoid that,
or update the machine with the older server.
regards, tom lane
---(end of broadcast)---
TIP 3: if posting/
s with different types.
But COALESCE is a special feature hard-wired into the parser. There's
no free lunch --- you pay for your extensibility somewhere.
regards, tom lane
---(end of broadcast)---
TIP 7: don't
lities
like polymorphism and inlining than on creating one-use facilities
like built-in LEAST/GREATEST.
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
lecting from the same table you're inserting into
were flat-out forbidden, as the MySQL docs claim.
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
re seq = table_name.seq-1)
where c is null;
because inside the sub-SELECT, unadorned "seq" will refer to the SELECT's
table.
You didn't say exactly what you wanted to do with null inputs, so that
issue may need more thought.
regards, tom lane
-
in use.
You might be able to use the contrib/userlock module for this.
regards, tom lane
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
SELECT setval('public.fdata _fid_seq', max(fid)+1) FROM fdata;
regards, tom lane
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
tting that this all runs
under MVCC rules. The sub-SELECTs will see the pre-existing versions
of the rows, whether or not the UPDATE has yet produced new versions.
regards, tom lane
---(end of broadcast)---
TIP 5: Have
-
Index Scan using t1i on t1 (cost=0.00..17.08 rows=5 width=32)
Index Cond: ((lower(f1) >= 'com.'::text) AND (lower(f1) < 'com/'::text))
Filter: (lower(f1) ~~ 'com.%'::text)
(3 rows)
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
intentional change.
If you want to keep your password in a file, see the ~/.pgpass feature.
regards, tom lane
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
rking ;-)).
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
tand why.
I'll bet there are some NULL values for secondpid in casecombo.
The behavior of NOT IN with NULLs is fairly unintuitive :-(
regards, tom lane
---(end of broadcast)---
TIP 6: Have you searched our l
It's hard to tell
whether you are dealing with a bug or pilot error ...
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
loat8larger probably should behave
likewise. (That actually is the same as what you want for MIN(), but
not for MAX() ...)
Comments anyone?
regards, tom lane
---(end of broadcast)---
TIP 3: if posting/reading through Usene
Jean-Luc Lachance <[EMAIL PROTECTED]> writes:
> If a compare with NaN is always false, how about rewriting it as:
> result = ((arg1 < arg2) ? arg2 : arg1).
That just changes the failure mode.
regards, tom lane
---(e
tency with the comparison operators. That was not the behavior
Michael wanted, but I don't see that we have much choice given the
wording of the SQL spec. Does anyone want to argue against that
definition?
regards, tom lane
-
ortant, but I don't think it's
important enough to disregard the spec...
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
the possibility that
they're not the last BEFORE trigger.)
regards, tom lane
---(end of broadcast)---
TIP 3: 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
#x27;re pretty much out of luck in that particular language.
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
ou got was a
tuple ...
Something to work on for 7.5, I suppose.
regards, tom lane
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
27;s always going to be
dependent on the platform having proper IEEE support, but that's no
excuse to throw it away.
regards, tom lane
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
ng onek_unique1 on onek (cost=0.00..21.40 rows=5 width=8)
Index Cond: (onek.unique1 = "outer".unique1)
(5 rows)
regression=#
Looks like a fairly decent plan to me. It's certainly not letting the
sub-select structure get in its way.
r
n and
> see if that changes the plan you get.
It might help --- you might possibly get a nestloop-with-inner-indexscan
out of that. Not sure though, since the planner is likely to be using
bad guesstimates about the selectivity of the expression.
7.4 should do better on this.
r. That's what the iscachable flag means: you are promising that
the function's output for given input never changes. If you aren't
prepared to make that promise, you cannot index the function.
regards, tom lane
--
ault localtimestamp
default 'now'::text
Given that you want timestamp without time zone, I'd probably use
"default localtimestamp".
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Denis Zaitsev <[EMAIL PROTECTED]> writes:
> On Sat, Jul 26, 2003 at 10:31:44AM -0400, Tom Lane wrote:
>> That's a dangerous way to define the default --- 'now' is taken as a
>> literal of type timestamp, which means it will be reduced to a timestamp
>> con
ferential integrity violation - key referenced from foo
> not found in foo
Seems to work in 7.3.4 and CVS tip:
regression=# update foo set a = 5 where a = 2;
UPDATE 1
regression=# select * from foo;
a | b
---+---
1 | 1
3 | 5
5 | 5
(3 rows)
regards, tom lane
--
arches for indexes matching OR-clauses.) You may also need to phrase
the ORDER BY as "prefix desc, tariff_type desc" to make it perfectly
clear to the planner that you don't need a separate sort step ... not
quite sure whether that will be needed or not.
regard
datetime input parser.
(It would be rather difficult for an application to allow this one case
without permitting SQL-injection attacks, I'd think.)
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
alue strings and not function invocations.
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
on
> before one.updatenr. - And that's where I run into trouble.
You might be able to make this work by using SELECT DISTINCT ON. See
the "weather reports" example in the SELECT reference page.
regards, tom lane
---(end of broad
we ever add support for SQL99's
LATERAL(), it might help improve matters.
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
very
ugly implementation though, mainly because it doesn't reverse-list
nicely in rule dumps. Sometime we should try to fix it so that it
reverse-lists as "current_timestamp(n)", and likewise for the similar
special cases in gram.y.
regards, tom lan
"A. Van Hook" <[EMAIL PROTECTED]> writes:
> this worked in 7.2.3
> "select sum(cr) from ar where date(tdate) = now() -1 "
> but not in 7.3.3
> What's the proper syntax for 7.3.3???
Perhaps you want current_date - 1.
regards, t
Toby Tremayne <[EMAIL PROTECTED]> writes:
> the explain data I'm currently getting is this:
"explain analyze" would be much more useful.
Also, I assume you've vacuum analyzed these tables recently?
regards, tom lane
---
nd pid I can fork a 'ps' command from my app,
> though it would be nicer to get it directly through sql.
There's a pg_backend_pid() function in 7.3 that returns your own PID.
Not sure if it was in 7.2.
regards, tom lane
---(end of br
EFT would really help any, but it couldn't hurt, since
LEFT restricts the planner's choices.)
regards, tom lane
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscri
there's a bug we need to fix. I'd
really like to see some profiling of the poor-performing
external-storage case, so we can figure out what's going on.
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
In 7.3.3 release notes:
* Fix misbehavior of replace() on strings containing '%'
regards, tom lane
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
e:
SELECT myfunc(mytablename) FROM mytablename;
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
e other tool that
is misreading or altering the dump file.
Personally, I would use pg_dump without -D. Recent versions give a
fairly nice behavior for embedded control characters:
COPY foo (f1) FROM stdin;
aaa\rbbb\r\nccc
aaa\rbbb\r\nccc
\.
regards, tom lane
--
undant ---
turn that off if you can. (Of course, if there is anything other than
Postgres files on the same device, you may not want to turn off contents
journalling...)
regards, tom lane
---(end of broadcast)---
TIP 2: you c
I don't believe there was a type "void" in PG 7.1. IIRC, back then the
custom was to say "RETURNS opaque" in this situation.
It's probably time for you to update to something newer ...
regards, tom lane
---(end
matters. Per bug #897.
regards, tom lane
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
(*) as numberingroup
from xrefmembergroup group by membergroupid) as c
where m.id = c.membergroupid;
I'm not convinced this will actually be much of a win in 7.3
unfortunately ... but it should fly in 7.4, because of the new
hash aggregation code.
regar
hard way to go about this. A better short-run solution is just
to create = and < operators for varchar[].
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
pared
> (and saved) SPI query, which uses an index:
> "select latitude, longitude from geo_zipdata where zip = $1"
How do you know it's using the index?
regards, tom lane
---(end of broadcast)---
TIP 9:
datetime(n) ---
you will have to do that when you update to 7.3 anyway, and it gets the
right answer on 7.2.
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
But really you do not need
a subquery for this at all; VALUES is perfectly content with scalar
expressions:
insert into table_name (field_name)
values (setval('sequence_name')-1);
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
rimary key --- the normal Postgres limit
is 32 keys but I can't believe anyone would use that many in practice).
regards, tom lane
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://
er than poking around in the
catalogs directly.
regards, tom lane
---(end of broadcast)---
TIP 8: explain analyze is your friend
You could see how testing "a" twice could be
> expensive in some situations.
It's actually done that way --- see the comments near the head of
src/backend/optimizer/prep/prepqual.c. There are some heuristics
to not do it if the expression expands "a lot&
or you can put it in quotes and let the parser figure out the right
type:
product_id = '29'
Yes, we'd like to make this better, but there are surprisingly many
pitfalls in tinkering with the assignment of datatypes to constants...
regards, tom lane
PS: you could
ation of AFTER triggers, but given the current timing this
is the behavior I'd expect.
regards, tom lane
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
you getting (seq scan or
multiple index scan)? Is it possible that the cost comes from planner
overhead and not execution? Checking EXPLAIN ANALYZE reported time
against actual elapsed time (cf psql's \timing option) would tell.
regards, tom lane
--
7;d say.
Which suggests a workaround for the moment: your trigger function should
be a SECURITY DEFINER.
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Bertrand Petit <[EMAIL PROTECTED]> writes:
> On Wed, Aug 20, 2003 at 04:32:19PM -0400, Tom Lane wrote:
>> against actual elapsed time (cf psql's \timing option) would tell.
> What is measured by the \timing option?
Elapsed time ... as seen by the client, of course.
27;::timestamp with time zone + your_ticks * '1 second'::interval;
regards, tom lane
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
of
> the table (and the function).
I seem to recall that the original coding of the RI triggers was
careless about executing the RI operations as the "right" user (namely
the table owner). This very possibly was still broken in 7.2.4.
regards, tom lane
--
the status of this bug is?
Try it in CVS tip ...
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
o there's no credible mechanism for now() to make such a mistake.
I think that your client software supplied a value for one field and
didn't supply a value for the other, and the supplied value was provided
in the wrong DateStyle.
regards, tom lane
Bruce Momjian <[EMAIL PROTECTED]> writes:
> Should we consider adding some warning when someone creates an index on
> an int2 column?
I don't think so. Better to expend our energy on solving the
fundamental problem.
regards, tom lane
-
e datestyle
to Euro to get dd-mm- input to be parsed reliably.
As of 7.4 this is being tightened up, btw --- it'll be mm-dd- or error.
But AFAICS this has nothing to do with a default now() insertion,
because that value is never converted to a string before it g
Bruce Momjian <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> Bruce Momjian <[EMAIL PROTECTED]> writes:
>>> Should we consider adding some warning when someone creates an index on
>>> an int2 column?
>>
>> I don't think so. Better to expen
inform other user that the record is edited?
Try using the contrib/userlock/ functions.
regards, tom lane
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
changes the column?
You won't find that out unless you actually compare the OLD and NEW
column values. If you assume the column has not changed just because
the original query text didn't change it, you are in for a world of hurt.
regards, tom lane
te a named cursor by binding the cursor
in DECLARE.)
> (2) How to fetch the content of the unnamed cursor at PgAdmin and at Comman=
> d prompt?
You probably need a BEGIN block in the psql case. Can't help you with
pgadmin.
regards, tom lane
-
ning?
regards, tom lane
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
but I believe could be created
SELECT DISTINCT ON might provide a simpler solution to that requirement.
Check out the "weather reports" example in the SELECT reference page.
regards, tom lane
---(end of broadcast)-
e, and can't
> find an obvious solution.
The state involved is in a linked list kept by commands/sequence.c.
Such a command would not be difficult to implement, if you could get
agreement on the syntax to use.
regards, tom lane
---(end of broad
uld connection poolers actually find it
useful? (I'd think it much more likely they want to re-use prepared
statements.)
regards, tom lane
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
cases where they'd be accepted
in a boolean-requiring SQL construct (such as CASE). (By default,
none are, so this isn't really different from #2. But people could
create casts to boolean to override this behavior in a controlled
fashion.)
Any opinions about what to do
Manfred Koizar <[EMAIL PROTECTED]> writes:
> On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]>
> wrote:
>> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans
>> will be accepted in exactly the same cases where they'd b
erent from #2. But people could
>> create casts to boolean to override this behavior in a controlled
>> fashion.)
At this point I'm kinda leaning to #4, because (for example) people
could create a cast from integer to boolean to avoid having to fix th
VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
If there's a bug here at all, it's that this function doesn't report a
type violation. What in the world do you think the semantics of that
IF-test are? text is not boolean.
regards, tom lane
--
sed by plpgsql at all, merely sent down to
the SQL engine, which does not know the output variable mx). The way to
get results out of an executed select is to use FOR ... IN EXECUTE.
Which is a kluge, but it holds the fort until someone gets around to
redesigning this code. See the manual.
k the second makes it
more clear what's going on.
BTW, if you use a table alias then the alias is the name to refer to.
SELECT foo(x.*) FROM tablename as x;
regards, tom lane
---(end of broadcast)---
TIP 5: Hav
7.3.3 has a nasty
bug that can cause it to fail to restart after a crash.
regards, tom lane
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
rom (select *, (cy_bfwd + dy_p1T4) as curr_bal from fclitot) as ss
where dy_yr = 0 and (curr_bal) <-0.005
This doesn't necessarily save you from evaluating the curr_bal
expression twice, mind you. It just saves you from writing it out
twice.
regards, tom lane
---
oks like it will apply
to 7.3 branch with some fuzz, but I have not actually tested it there).
regards, tom lane
*** src/pl/plpython/plpython.c.orig Mon Aug 4 14:40:50 2003
--- src/pl/plpython/plpython.c Sun Sep 14 13:07:02 2003
***
*** 224,236
imilar to "SET search_path TO whatever;").
If the script is being fed to psql, it can use \c ...
regards, tom lane
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
g_controldata, "strings
$PGDATA/global/pg_control" will do as a rough-and-ready substitute.)
Theoretically it should work to do
export LC_COLLATE=C
export LC_CTYPE=C
initdb
but if you have LANG or other LC_xxx values in your environment,
it's possible that there is
Y to the cursor's
query. (You will need to do some investigation with EXPLAIN to make
sure you are getting a suitable plan for the cursor.)
Or try 7.4 beta ...
regards, tom lane
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings
for finite set of expected variables, not for arbitrary values.
How do you figure that? AFAICS "FOR" with a record variable as target
will cover any case that SELECT INTO could handle.
regards, tom lane
---(end of broadcast)-
out success.
pg_dump can only handle one -t option at a time. It'd make sense to
allow multiple -t options (likewise -n) but no one's got round to
improving the code in that particular direction. I don't think it would
be hard; want to fix it and send in a patc
alue. Why don't you just declare the column as timestamp(2) ? All
this fooling around with substrings is inefficient and doesn't have much
to do with your real intent anyhow.
regards, tom lane
---(end of broadcast)
ostgresql.org/docs/7.3/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
regards, tom lane
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
add_one
-
11
(1 row)
Perhaps you should show us exactly what you did.
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
bug in your
code is that your C function needs to call SPI_connect and SPI_finish
if it's going to use any SPI operations.
regards, tom lane
Index: spi.c
===
RCS file: /cvsroot/pgsql-server/src/backend
en a builtin function and a dynamically loaded one is
you have to add the PG_FUNCTION_INFO macro.
regards, tom lane
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
ple
create function nullif(anyelement, anyelement) returns anyelement as
'select case when $1 = $2 then null else $1 end' language sql;
I'm not sure we're all the way there yet, cf
http://archives.postgresql.org/pgsql-general/2003-09/msg00500.php
don't think $libdir is the real value that we want.
Yes it is.
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
901 - 1000 of 2610 matches
Mail list logo