[BUGS] BUG #4402: Column expansion: date comes wthout a cast

2008-09-05 Thread Joachim Unger

The following bug has been logged online:

Bug reference:  4402
Logged by:  Joachim Unger
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.3
Operating system:   Windwos XP Professional 32 Bit
Description:Column expansion: date comes wthout a cast
Details: 

The column expansion lists date types without a date cast.

Here is an example where I'm using NEW inside a trigger:
[...]
ins_sql := 'INSERT INTO ' ||   quote_ident(new_child_table) || '('
||col_names(new_child_table) || ') VALUES ' || NEW;
RAISE NOTICE 'INSERT: %',ins_sql;
EXECUTE ins_sql;
[...]

Execution of the generated  SQL throws an error:

ERROR:  column "adate" is of type date but expression is of type integer
LINE 1: INSERT INTO table_2008_1(id,adate) VALUES (1,2008-01-30)
HINT:  You will need to rewrite or cast the expression.

That hint describes exactly what is missing:(1,DATE '2008-01-30')

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #4398: Backslashes get escaped despite of backslash_quote=off

2008-09-05 Thread Rainer Glueck
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello Tom,

On 4 Sep 2008 at 12:53, Tom Lane wrote:
>
> "Rainer Glueck" <[EMAIL PROTECTED]> writes:
> > How can backslashes be stopped from escaping themselves in like-statements
> 
> Use ESCAPE ''.  There isn't any other way provided.
> ...
> if you have no escape character then you have no way to quote % and _

Yes, that's true indeed.
And since I learned that the escape clause is recommended to cope
with that matter not only by PostgreSQL, but also by Transact-SQL,
I'm going to adapt my database connector this way, withdraw this topic
and thank you for pushing me a little bit more to enlightenment. :)

Regards,
Rainer




-BEGIN PGP SIGNATURE-
Version: idw's PGP-Frontend 5.1.0.0 / 4-2006 + PGP 6.5.8
Comment: KEY: 0x231D96D8 - FP: 9E01C5D7 7041D0C4 804F4705 76216606 231D96D8

iQA/AwUBSMDeV3YhZgYjHZbYEQKv3gCgx6UWMbVLsym6hb8/DG91JMNX3OAAoK9M
NrpA0F3AGjPeqacOks2AVtJe
=8SXN
-END PGP SIGNATURE-

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #4374: pg_restore does not restore public schema comment

2008-09-05 Thread Bruce Momjian
Tom Lane wrote:
> Craig Ringer <[EMAIL PROTECTED]> writes:
> > The issue actually appears to be that the comment on default schema like
> > `public' isn't dumped in the first place.
> 
> Hmm ... there is a specific exclusion in _printTocEntry to suppress
> dumping of either the CREATE SCHEMA command for "public" or its comment.
> I don't quite recall the reasoning [ digs... ]  Oh, here it is:
> http://archives.postgresql.org/pgsql-committers/2008-01/msg00212.php
> You can probably find some related discussion in the archives right
> before that, but the commit message is clear enough.
> 
> On the whole, since "public" is a quasi-built-in object, it doesn't seem
> like a very good idea to depend on being able to alter its properties.
> Why not attach your version comment to some other, entirely user-defined
> object?  "CREATE SCHEMA version" perhaps ...

I have added a comment in the source code about this.

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #4377: casting result of timeofday() to timestamp fails in some timezones

2008-09-05 Thread Bruce Momjian
Todd A. Cook wrote:
> Tom Lane wrote:
> > 
> > In the meantime, why aren't you just using clock_timestamp()?
> > timeofday() is deprecated.
> 
> I am using clock_timestamp() now.  The use of timeofday() was from the era
> when 8.0 was hot stuff.
> 
> BTW, the word "deprecated" does not appear on the docs page where timeofday()
> is listed (http://www.postgresql.org/docs/8.3/static/functions-datetime.html),
> and there doesn't seem to be anything in the context of the 3 occurrences of
> "timeofday" that would imply it is deprecated.

Uh, we will probably never remove timeofday() but the new functions are
clearer.

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #4402: Column expansion: date comes wthout a cast

2008-09-05 Thread Euler Taveira de Oliveira
Joachim Unger escreveu:
> The column expansion lists date types without a date cast.
> 
And all of the text types too.

> Here is an example where I'm using NEW inside a trigger:
> [...]
> ins_sql := 'INSERT INTO ' ||   quote_ident(new_child_table) || '('
> ||col_names(new_child_table) || ') VALUES ' || NEW;
> RAISE NOTICE 'INSERT: %',ins_sql;
> EXECUTE ins_sql;
> [...]
> 
Why aren't you expanding it yourself? Currently, PostgreSQL doesn't have
a function that does the quoting-if-needed automagically.


-- 
  Euler Taveira de Oliveira
  http://www.timbira.com/

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs