Thread: Updating timestamps

Updating timestamps

From
Nigel Horne
Date:
Is it possible to update a timestamp with Postgresql?


I've looked around with google and it looks as though this should work:


exec sql begin declare section;
char api[18];
char    expiration_time[80];
exec sql end declare section;


memcpy(api, ap->api, sizeof(api));
sprintf(expiration_time, "%s + \"interval\"('0.01sec')",
ap->expiration_time);


puts(expiration_time);


exec sql update accesspoint
        set sequence_number = expiration_time = :expiration_time,
        where api = :api;


However, I just get this:
2005-08-02 10:37:41.198479 + "interval"('0.01sec')
'ERROR:  invalid input syntax for type timestamp: "2005-08-02 10:37:4

-Nigel


Simple PG Sql question (i hope)

From
Tony Caduto
Date:
I have a simple query:

select true,78,'Here is a value' as stringfield, testname from tbltest;

it returns:
true as bool
 78 as int4
and the string 'Here is a value' as Unknown

Why is it that all the values besides the string come back with the
correct type?
what is a simple string being returned as unknown instead of varchar or
text?


Thanks,

Tony

AMD 64 RPM?

From
Tony Caduto
Date:
I have a Red Hat EL 4 server and they only ship 7.x with it, but I want
to run 8.x on it.
The server is running in 64bit mode and was wondering if there is a RPM
available? (I could only find 32bit ones on the Postgresql web page)

Thanks,

Tony

Re: Simple PG Sql question (i hope)

From
"Joshua D. Drake"
Date:
Tony Caduto wrote:
> I have a simple query:
>
> select true,78,'Here is a value' as stringfield, testname from tbltest;
>
> it returns:
> true as bool
> 78 as int4
> and the string 'Here is a value' as Unknown
>
> Why is it that all the values besides the string come back with the
> correct type?
> what is a simple string being returned as unknown instead of varchar or
> text?

Because it doesn't know what you want it as :) For example in 8.0.3:


template1=# select true,78,'Here is a value' as stringfield;
  bool | ?column? |   stringfield
------+----------+-----------------
  t    |       78 | Here is a value
(1 row)

Or

template1=# select true,78::int4,'Here is a value'::text as stringfield;
  bool | int4 |   stringfield
------+------+-----------------
  t    |   78 | Here is a value
(1 row)


Sincerely,

Joshua D. Drake


>
>
> Thanks,
>
> Tony
>
> ---------------------------(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


--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: AMD 64 RPM?

From
"Joshua D. Drake"
Date:
Tony Caduto wrote:
> I have a Red Hat EL 4 server and they only ship 7.x with it, but I want
> to run 8.x on it.
> The server is running in 64bit mode and was wondering if there is a RPM
> available? (I could only find 32bit ones on the Postgresql web page)

Just download the source RPM and:

rpmbuild -bb --target=i686 src.rpm

Sincerely,

Joshua D. Drake


>
> Thanks,
>
> Tony
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly


--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: Simple PG Sql question (i hope)

From
Tony Caduto
Date:
Hi,
I don't think I was clear enough.

I know about using the AS keyword, that is not the problem.
The query in issue is:

select true,78,'Here is a value' as stringfield, testname from tbltest

Is returning the string as TYPE Unknown, not the column name.  The
column name comes back as stringfield because of the AS keyword.

You can see the type in tools such as PG Admin etc

Thanks,

Tony

Re: AMD 64 RPM?

From
Tony Caduto
Date:
Hi Joshua,

Forgive me but I am not normally a redhat user (normally Gentoo)

So it will build a 64bit binary by default, there is no editing of the
spec file or anything else required?

Thanks,

Tony



>
> Just download the source RPM and:
>
> rpmbuild -bb --target=i686 src.rpm
>
> Sincerely,
>

Re: AMD 64 RPM?

From
"Joshua D. Drake"
Date:
Tony Caduto wrote:
> Hi Joshua,
>
> Forgive me but I am not normally a redhat user (normally Gentoo)
>
> So it will build a 64bit binary by default, there is no editing of the
> spec file or anything else required?

Oh if you are using 64bit then just:

rpmbuild -bb --target=x86_64 src.rpm

You may need to add some rpms in advance such as:

openssl-devel
rpm-build

But once your depends are resolved yes you should be good to go.

Sincerely,

Joshua D. Drake


>
> Thanks,
>
> Tony
>
>
>
>>
>> Just download the source RPM and:
>>
>> rpmbuild -bb --target=i686 src.rpm
>>
>> Sincerely,
>>


--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Re: Simple PG Sql question (i hope)

From
Martijn van Oosterhout
Date:
On Mon, Aug 08, 2005 at 03:05:13PM -0500, Tony Caduto wrote:
> Hi,
> I don't think I was clear enough.
>
> I know about using the AS keyword, that is not the problem.
> The query in issue is:
>
> select true,78,'Here is a value' as stringfield, testname from tbltest
>
> Is returning the string as TYPE Unknown, not the column name.  The
> column name comes back as stringfield because of the AS keyword.

What about the query:

select 't','78','Here is a value' as stringfield, testname from tbltest

This gives you three Unknown fields. PostgreSQL can't know that the
first is to be a bool or that the second is to be an int until you
actually give it a type. Usually via casting or by inserting into a
table/

Single quotes denote an untyped constant, not a string.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

Re: AMD 64 RPM?

From
Tony Caduto
Date:
Thanks for your help Joshua.

I will give it a try.

Tony

>> o it will build a 64bit binary by default, there is no editing of the
>> spec file or anything else required?
>
>
> Oh if you are using 64bit then just:
>
> rpmbuild -bb --target=x86_64 src.rpm
>
> You may need to add some rpms in advance such as:
>
> openssl-devel
> rpm-build
>
>
>


Re: AMD 64 RPM?

From
Devrim GUNDUZ
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Mon, 8 Aug 2005, Tony Caduto wrote:

> I have a Red Hat EL 4 server and they only ship 7.x with it, but I want to
> run 8.x on it.
> The server is running in 64bit mode and was wondering if there is a RPM
> available? (I could only find 32bit ones on the Postgresql web page)

I double-checked and realized that we have no servers to build 64-bits
RPMs for RHEL 4. I've built ones for RHEL 3.0, but they may not work for
you.

If you can succeed building the RPMs as Joshua guided, please let me know
and we can upload the binaries to FTP site.

If anyone is interested, RHEL 3.0 x86_64 RPMs will be available in main
FTP site in an hour.

Regards,
- --
Devrim GUNDUZ
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.tdmsoft.com.tr                      http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFC98jttl86P3SPfQ4RAs4eAJ9V827OJyj/3RBioS1XnNwI891oMwCg6oQr
XGK3gi/FWstkFe/5tW9vITA=
=IqzT
-----END PGP SIGNATURE-----

Re: Simple PG Sql question (i hope)

From
Tony Caduto
Date:
I always thought that single qoutes in a sql statement meant a
string/varchar/text.
Thanks for the info on this.

>
>Single quotes denote an untyped constant, not a string.
>
>Hope this helps,
>
>


Re: [Pgsqlrpms-hackers] Re: AMD 64 RPM?

From
"Sander Steffann"
Date:
Hi,

> I double-checked and realized that we have no servers to
> build 64-bits RPMs for RHEL 4. I've built ones for RHEL 3.0,
> but they may not work for you.
>
> If you can succeed building the RPMs as Joshua guided, please
> let me know and we can upload the binaries to FTP site.

As promised: I put them on http://opensource.nederland.net/PostgreSQL/

- Sander.


Re: [Pgsqlrpms-hackers] Re: AMD 64 RPM?

From
Devrim GUNDUZ
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi Sander,

On Tue, 9 Aug 2005, Sander Steffann wrote:

>> If you can succeed building the RPMs as Joshua guided, please
>> let me know and we can upload the binaries to FTP site.
>
> As promised: I put them on http://opensource.nederland.net/PostgreSQL/

Thanks a lot :)

I've uploaded the RPMs to main FTP site (under
/pub/binary/v8.0.3/linux/rpms/redhat/rhel-4-x86_64). They will be
available in an hour. Also they will be on the mirrors after first sync.

Regards,

- --
Devrim GUNDUZ
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                      http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFC+Gfetl86P3SPfQ4RAqvQAJ41lWs2wuZ+sI6iiNlQgf7X+IIlOwCfXP4N
zMflttn5SqzjadfJRqbyLkc=
=aiR7
-----END PGP SIGNATURE-----