Re: [GENERAL] Conversion from CHAR HEX

2014-05-28 Thread Shaun Thomas
On 05/27/2014 09:47 AM, saqibrafique wrote: fm_db_Server1=# *select to_hex(to_number(substr(from_ip, 1, 3), '999')) as price from operator;* /ERROR: function to_hex(numeric) does not exist LINE 1: select to_hex(to_number(substr(from_ip, 1, 3), '999')) as p... ^ There's no to

[GENERAL] Conversion from CHAR HEX

2014-05-28 Thread saqibrafique
hi guys, I am trying to convert a simple char value to HEX but I am getting Error. *MyTable:* CREATE TABLE mytable (from_ip CHAR(20), to_ip CHAR(20)); *I have below values in the Table:* fm_db_Server1=# select * from operator; from_ip|to_ip ---

Re: [GENERAL] Conversion from CHAR HEX

2014-05-27 Thread David G Johnston
saqibrafique wrote > hi guys, > I am trying to convert a simple char value to HEX but I am getting Error. > * > MyTable: * > > CREATE TABLE mytable (from_ip CHAR(20), to_ip CHAR(20)); * > I have below values in the Table: * > > > fm_db_Server1=# select * from operator; >from_ip

Re: [GENERAL] conversion from epoch

2012-07-30 Thread Adrian Klaver
On 07/30/2012 07:36 AM, Little, Douglas wrote: I have an input source that is in epoch time.Is there a built-in conversion to changing to timestamp http://www.postgresql.org/docs/9.1/interactive/functions-formatting.html " to_timestamp(double precision) timestamp with time zone convert Unix

Re: [GENERAL] conversion from epoch

2012-07-30 Thread Steve Atkins
On Jul 30, 2012, at 7:36 AM, Little, Douglas wrote: > I have an input source that is in epoch time.Is there a built-in > conversion to changing to timestamp to_timestamp(). You can also do things like "select timestamptz 'epoch' + ? * interval '1 second'". Cheers, Steve -- Sent via

Re: [GENERAL] conversion from epoch

2012-07-30 Thread Andreas Kretschmer
"Little, Douglas" hat am 30. Juli 2012 um 16:36 geschrieben: > I have an input source that is in epoch time.Is there a built-in > conversion to changing to timestamp > > > select 'epoch'::date + * '1second'::interval; Andreas -- Sent via pgsql-general mailing list (pgsql-genera

[GENERAL] conversion from epoch

2012-07-30 Thread Little, Douglas
I have an input source that is in epoch time.Is there a built-in conversion to changing to timestamp Thanks Doug Little Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide 500 W. Madison, Suite 1000 Chicago IL 60661| Office 312.260.2588 | Fax 312.894.516

Re: [GENERAL] Conversion of columns during CSV Import

2012-07-01 Thread Jasen Betts
On 2012-06-29, Patrick Schneider wrote: > Hello, > > is there any possibility to convert special columns during an CSV import > via COPY? > For example: > > HELLO;WORLD;;011001 > > should be converted to a character field do you mean like '' (easy) or like '香' or like '✏' (harder)

Re: [GENERAL] Conversion of columns during CSV Import

2012-06-29 Thread Edson Richter
Em 29/06/2012 14:10, Raymond O'Donnell escreveu: On 29/06/2012 08:54, Patrick Schneider wrote: Hello, is there any possibility to convert special columns during an CSV import via COPY? For example: HELLO;WORLD;;011001 should be converted to a character field 011001 to the date 10th J

Re: [GENERAL] Conversion of columns during CSV Import

2012-06-29 Thread Alban Hertroys
On 29 Jun 2012, at 9:54, Patrick Schneider wrote: > Hello, > > is there any possibility to convert special columns during an CSV import via > COPY? > For example: > > HELLO;WORLD;;011001 > > should be converted to a character field > 011001 to the date 10th January 2001 > > For the m

Re: [GENERAL] Conversion of columns during CSV Import

2012-06-29 Thread Steve Crawford
On 06/29/2012 12:54 AM, Patrick Schneider wrote: Hello, is there any possibility to convert special columns during an CSV import via COPY? For example: HELLO;WORLD;;011001 should be converted to a character field 011001 to the date 10th January 2001 For the moment the only idea we

Re: [GENERAL] Conversion of columns during CSV Import

2012-06-29 Thread Raymond O'Donnell
On 29/06/2012 08:54, Patrick Schneider wrote: > Hello, > > is there any possibility to convert special columns during an CSV import > via COPY? > For example: > > HELLO;WORLD;;011001 > > should be converted to a character field > 011001 to the date 10th January 2001 > > For the moment

[GENERAL] Conversion of columns during CSV Import

2012-06-29 Thread Patrick Schneider
Hello, is there any possibility to convert special columns during an CSV import via COPY? For example: HELLO;WORLD;;011001 should be converted to a character field 011001 to the date 10th January 2001 For the moment the only idea we have is, to import the CSV into a TEMP table and

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-19 Thread Sam Mason
On Wed, Nov 19, 2008 at 12:50:23PM +0200, Andrus wrote: > Sam, > > SELECT MAX(nullif(regexp_replace(test, '^([0-9]*).*$', E'\\1'),'')::INT); > > Thank you. > This seems to work but is bit slow. It will have to be executed against every row before you get an answer, so if you're just after the max

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-19 Thread Andrus
Sam, Maybe something like: SELECT MAX(nullif(regexp_replace(test, '^([0-9]*).*$', E'\\1'),'')::INT); Thank you. This seems to work but is bit slow. How to speed it up ? Should I create index CREATE INDEX test ON test ( nullif(regexp_replace(test, '^([0-9]*).*$', E'\\1'),'')::INT ); ?

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-18 Thread Andrus
Raymond, You could use a regular expression in substring() to get just the numeric bits. Thank you. I do'nt have any experience on regex. Can you provide a sample how to use regex to get numeric substring from start of string ? Andrus. -- Sent via pgsql-general mailing list (pgsql-gener

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 05:51:08PM +, Raymond O'Donnell wrote: > You could use a regular expression in substring() to get just the > numeric bits. Thanks, never noticed that substring would accept a regexp before. Syntax is a bit baroque, but it seems to work! Sam -- Sent via pgsql-gener

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-18 Thread Sam Mason
On Tue, Nov 18, 2008 at 07:33:47PM +0200, Andrus wrote: > I need to obtain max integer considering only numbers from start of column > up to first non-integer character. > > I tried > > create temp table test (test char(20)); > insert into test values ('12'); > insert into test values ('23/3');

Re: [GENERAL] Conversion of string to int using digits at beginning

2008-11-18 Thread Raymond O'Donnell
On 18/11/2008 17:33, Andrus wrote: > create temp table test (test char(20)); > insert into test values ('12'); > insert into test values ('23/3'); > insert into test values ('AX/3'); > select max(test::int) from test; > > but got > > ERROR: invalid input syntax for integer: "23/3 " > > Ho

[GENERAL] Conversion of string to int using digits at beginning

2008-11-18 Thread Andrus
Table contains CHAR(20) type columns containing numbers and other values. I need to obtain max integer considering only numbers from start of column up to first non-integer character. I tried create temp table test (test char(20)); insert into test values ('12'); insert into test values ('23/

Re: [GENERAL] Conversion to 8.3

2008-04-07 Thread Terry Lee Tucker
On Saturday 05 April 2008 11:21, Tom Lane wrote: > "Scott Marlowe" <[EMAIL PROTECTED]> writes: > > what type is new.ontime ?? timestamp or interval. I would expect it > > to be an interval. But intervals are either negative or positive, not > > "ago" unless that's something peculiar to 7.4 that

Re: [GENERAL] Conversion to 8.3

2008-04-05 Thread Terry Lee Tucker
On Friday 04 April 2008 16:36, Tom Lane wrote: > Terry Lee Tucker <[EMAIL PROTECTED]> writes: > > I am converting our application from 7.4.19 to 8.3.1. In the old scheme > > of things, I was generating an interval between two timestamps and > > evaluating the interval string in another set of trigg

Re: [GENERAL] Conversion to 8.3

2008-04-05 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > what type is new.ontime ?? timestamp or interval. I would expect it > to be an interval. But intervals are either negative or positive, not > "ago" unless that's something peculiar to 7.4 that I've long since > forgotten. No, it's still around: re

Re: [GENERAL] Conversion to 8.3

2008-04-04 Thread Scott Marlowe
On Fri, Apr 4, 2008 at 2:39 PM, Terry Lee Tucker <[EMAIL PROTECTED]> wrote: > On Friday 04 April 2008 15:01, Craig Ringer wrote: > > > Terry Lee Tucker wrote: > > > Greetings: > > > > > > I am converting our application from 7.4.19 to 8.3.1. In the old scheme > > > of things, I was generating a

Re: [GENERAL] Conversion to 8.3

2008-04-04 Thread Terry Lee Tucker
On Friday 04 April 2008 16:36, Tom Lane wrote: > Terry Lee Tucker <[EMAIL PROTECTED]> writes: > > I am converting our application from 7.4.19 to 8.3.1. In the old scheme > > of things, I was generating an interval between two timestamps and > > evaluating the interval string in another set of trigg

Re: [GENERAL] Conversion to 8.3

2008-04-04 Thread Terry Lee Tucker
On Friday 04 April 2008 15:01, Craig Ringer wrote: > Terry Lee Tucker wrote: > > Greetings: > > > > I am converting our application from 7.4.19 to 8.3.1. In the old scheme > > of things, I was generating an interval between two timestamps and > > evaluating the interval string in another set of tri

Re: [GENERAL] Conversion to 8.3

2008-04-04 Thread Tom Lane
Terry Lee Tucker <[EMAIL PROTECTED]> writes: > I am converting our application from 7.4.19 to 8.3.1. In the old scheme of > things, I was generating an interval between two timestamps and evaluating > the interval string in another set of trigger code. I was doing the > following: > IF new.ontim

Re: [GENERAL] Conversion to 8.3

2008-04-04 Thread Craig Ringer
Terry Lee Tucker wrote: Greetings: I am converting our application from 7.4.19 to 8.3.1. In the old scheme of things, I was generating an interval between two timestamps and evaluating the interval string in another set of trigger code. I was doing the following: IF new.ontime IS NOT NULL AN

[GENERAL] Conversion to 8.3

2008-04-04 Thread Terry Lee Tucker
Greetings: I am converting our application from 7.4.19 to 8.3.1. In the old scheme of things, I was generating an interval between two timestamps and evaluating the interval string in another set of trigger code. I was doing the following: IF new.ontime IS NOT NULL AND new.ontime ~* 'ago' THEN

Re: [GENERAL] Conversion of Database to schema aware

2005-08-12 Thread Alvaro Herrera
On Fri, Aug 12, 2005 at 11:36:01PM +0800, Richard Sydney-Smith wrote: > if a new command were available to transfer between schemas then the > wishlist would eventually extend to ... > > transfer [table] [view] [rule] public.* to schema yyy; > > Where * would mean all entries of the selected typ

[GENERAL] Conversion of Database to schema aware

2005-08-12 Thread Richard Sydney-Smith
I have a database which over many years and clients has grown to about 140 tables with attendant triggers , rules and views. Having transferred to the postgresql community from another database provider the design did not include the use of schema. During a recent review it struck me just how use

Re: [GENERAL] conversion

2000-12-12 Thread Tom Lane
"Nathan Suderman" <[EMAIL PROTECTED]> writes: > how can I convert varchar to int? I can not seem to cast the type > (::int2) and there are no conversion functions in the docs > (int(varchar)). What Postgres version are you using? This works fine for me in 7.0 and later...

Re: [GENERAL] Conversion MySql -> PostgresSQL

2000-10-29 Thread Alex Pilosov
On Sat, 28 Oct 2000, William H. Geiger III wrote: > Hi, > > I am new to PostgreSQL and I am trying to convert a MySQL database over. > There are a couple of basics I need to clear up: > > On the numeric INT types can they be set to unsigned? I have 32-bit & > 64bit unsigned integers that I need

[GENERAL] Conversion MySql -> PostgresSQL

2000-10-28 Thread William H. Geiger III
Hi, I am new to PostgreSQL and I am trying to convert a MySQL database over. There are a couple of basics I need to clear up: On the numeric INT types can they be set to unsigned? I have 32-bit & 64bit unsigned integers that I need to store in the majority of the tables in the database. All the

Re: [GENERAL] Conversion from MS Access to Postgresql

2000-06-27 Thread davidb
grate your yes/no fields to int2. David Boerwinkle -Original Message- From: Mihai Gheorghiu <[EMAIL PROTECTED]> To: Stephen Davies <[EMAIL PROTECTED]>; G.L.Lim <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Tuesday, June 27, 2000 9:07 AM Subject

Re: [GENERAL] Conversion from MS Access to Postgresql

2000-06-27 Thread Mihai Gheorghiu
.L.Lim <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Monday, June 26, 2000 7:54 PM Subject: Re: [GENERAL] Conversion from MS Access to Postgresql >G'day. > >Having just done it, I can confirm that converting an Access database >to PostgreSQL is ver

Re: [GENERAL] Conversion from MS Access to Postgresql

2000-06-27 Thread Tom Lane
"Len Morgan" <[EMAIL PROTECTED]> writes: > ... I cannot seem to make Postgres join two > tables when the type of one is char(9) and the other is character > varying(9). The machine seems to go into an endless loop. What? Specific example, please. > A similar problem I have is with fix precisi

Re[2]: [GENERAL] Conversion from MS Access to Postgresql

2000-06-26 Thread Yury Don
Hello Len, Once, Tuesday, June 27, 2000, 4:22:08 AM, you wrote: LM> While we're on the subject of Access/Postgres, I have a consistent problem LM> in moving tables between Access and Postgres. Access doesn't seem to want LM> to export a fixed length character field (i.e., I have a text field th