[SQL] Problem in Porting from Oracle to Postgres SQl

2001-05-11 Thread Amit


Hi!
I am facing two problems in porting from oracle to Postgres SQL.
1> There is a code in Oracle like
  Type Tstate is table of number(9)
    index by binary_integer;
.

To define a runtime table, basically it works like a array, How can
it be possible in Postgres SQL,
I have tried create temp table But it not works..
Is there any way to use arrays.
 
2> There is one function in Oracle Executesql '...' to
execute
    and what i got in Postgres is Execute immediate
'.'
    But it is giving error at Execute.
I will be very thankful if any one help me.
  Amit
( India )


[SQL] Indexing question

2012-08-15 Thread amit sehas
In SQL, given a table T, with two fields f1, f2, 

is it possible to create an index such that the same record is indexed in the 
index, once with field f1 and once with field f2.  (I am not looking for a 
compound index in which the key would look like , instead there should 
be two entries in the index  and ).  

we have a few use cases for the above, perhaps we need to alter the schema 
somehow to accommodate the above, 

any advice is greatly appreciated ..

thanks


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


Re: [SQL] [NOVICE] Understanding Encoding

2013-09-05 Thread Amit Langote
On Fri, Sep 6, 2013 at 2:56 PM, Beena Emerson  wrote:
> Hello All,
>
> I am not able to understand how the encoding is handled. I would be happy if
> someone can tell what is happening in the following scenario:
>
> 1. I have created a database with EUC_KR encoding and created a table and
> inserted some korean value into it.
>
> =# CREATE DATABASE korean WITH ENCODING 'EUC_KR' LC_COLLATE='ko_KR.euckr'
> LC_CTYPE='ko_KR.euckr' TEMPLATE=template0;
>
> =# \c korean
>
> korean=# SHOW client_encoding;
>  client_encoding
> -
>  UTF8
> (1 row)
>
> korean=# CREATE TABLE tbl (doc text);
>
> korean=# INSERT INTO tbl VALUES ('그레스');
>
>
> 2. If I insert non-korean values it throws error:
>
> korean=# INSERT INTO tbl VALUES ('データベース');
> ERROR:  character with byte sequence 0xe3 0x83 0xbc in encoding "UTF8" has
> no equivalent in encoding "EUC_KR"
>
> korean=# SELECT * FROM tbl;
>   doc
> 
>  그레스
> (1 row)
>
>
> 3. I change the client encoding to EUC_KR and try inserting the same korean
> characters and it throws an error:
>
> korean=# SET client_encoding = 'EUC_KR';
> SET
> korean=# INSERT INTO tbl VALUES ('그레스');
> ERROR:  invalid byte sequence for encoding "EUC_KR": 0xa0 0x88
>
>
> Even the SELECT statement displays something different. I am not able to
> understand why?
>
> korean=# SELECT * FROM tbl;
>   doc
> 
>  �׷���
> (1 row)
>

I wonder if you have tried changing your "locale" to ko_KR; something like:

LANG=ko_KR LC_ALL=ko_KR \
psql -d korean


--
Amit Langote


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


Re: [SQL] [NOVICE] Understanding Encoding

2013-09-06 Thread Amit Langote
On Fri, Sep 6, 2013 at 3:47 PM, Beena Emerson  wrote:
>
>>
>> I wonder if you have tried changing your "locale" to ko_KR; something
>> like:
>>
>> LANG=ko_KR LC_ALL=ko_KR \
>> psql -d korean
>>
>
> Hi,
>
> It still gives same result:
>
> $ LANG=ko_KR LC_ALL=ko_KR
> $ psql -d korean
>
> korean=# SHOW client_encoding;
>  client_encoding
> -
>  EUC_KR
> (1 row)
>
> korean=# INSERT INTO tbl VALUES ('그레스');
> ERROR:  invalid byte sequence for encoding "EUC_KR": 0xa0 0x88


I changed the encoding of the terminal emulator (GNOME Terminal
2.31.3) using the Terminal menu as:

Terminal -> Set Character Encoding -> Korean (EUC-KR)

Note that, if the menu only lists UTF-8, you'd have to add EUC-KR
using "Add or Remove".

And it seems to work; could you try the same?

--
Amit Langote


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


[SQL] Query for block updates

2006-12-03 Thread Amit Shah
Hi,

If this question doesn't belong to this mailing list, please pardon.

I have a table with a few hundred million rows, and I need to write a query 
that does something like follows --

Change all the values of a column to null where the value cannot be casted to 
numeric(20,4)

I have it as varchar, and I need to convert it to numeric(20,4).

I am using this query - alter table optiondata ALTER volume TYPE numeric(20,4) 
using cast(volume as numeric(20,4)); then wait for DB to complain, and then 
update that value to null, and just keep doing this till all garbadge is 
removed :-(

Thanks,
Amit

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[SQL] How to configure postgresql to accept TCP/IP connections

2005-04-22 Thread amit kumar awasthi

  
Hello sir 
actually i am working with Qt using postgresql i have to get connection 
{(database("trainee"),user("trainee"))}
from the network (database remote accessing) so i have configured

postgresql.conf and pg_hba.conf upto some extents

the fields that i  have configured r as follows even then 

while connecting by giving any address (even localhost) it flashes error

no pg_hba.conf entry for host 127.0.0.1 user"trainee" database "trainee"
SSL off 
QPSQL:Unable to connect

in pg_hba.conf

# Using sockets credentials for improved security. Not available everywhere,
# but works on Linux, *BSD (and probably some others)
local  all    all             ident   sameuser
#local  all    all             127.0.0.1   sameuser
only this entry i have made

in postgresql.conf

# - Connection Settings -

tcpip_socket = true
max_connections = 100
     # note: increasing max_connections costs about 500 bytes of shared
     # memory per connection slot, in addition to costs from shared_buffers
        # and max_locks_per_transaction.
superuser_reserved_connections = 2
#port = 5432
#unix_socket_directory = '/home/trainee/trainee'
#unix_socket_group = 'trainee'


#authentication_timeout = 60     # 1-600, in seconds
#ssl =true

if i do ssl true active then even ir is not giving psql prompt


please help me i am in trouble