[SQL] How to insert Images(bnp,png,etc) into Postgresql and how to retrive the inserted Imaged using C#.net

2008-12-18 Thread venkat
Dear All,

  I want   to insert Images(bnp,png,etc) into Postgresql and how to retrieve
the inserted Imaged using C#.net.I do not know where to start? Any one can
help me.

 I am waiting for your great response.

Advanced Thanks,
Venkat.


[SQL] Re: How to insert Images(bnp,png,etc) into Postgresql and how to retrive the inserted Imaged using C#.net

2008-12-18 Thread Milen A. Radev
venkat написа:
> Dear All,
> 
>   I want   to insert Images(bnp,png,etc) into Postgresql and how to retrieve
> the inserted Imaged using C#.net.I do not know where to start? Any one can
> help me.
[...]

Start here  -
http://npgsql.projects.postgresql.org/docs/manual/UserManual.html and
look for "Working with binary data and bytea datatype".


-- 
Milen A. Radev


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


Re: [SQL] Re: How to insert Images(bnp,png,etc) into Postgresql and how to retrive the inserted Imaged using C#.net

2008-12-18 Thread venkat
HI Milen,

  Thanks for your great response,I do not find anything like insert images..
I have seen the whole tutorial..Please can you give me some example to
insert images into postgresql.

I am waiting for your great response.

Thanks,
Venkat.

On Thu, Dec 18, 2008 at 8:02 PM, Milen A. Radev  wrote:

> venkat написа:
> > Dear All,
> >
> >   I want   to insert Images(bnp,png,etc) into Postgresql and how to
> retrieve
> > the inserted Imaged using C#.net.I do not know where to start? Any one
> can
> > help me.
> [...]
>
> Start here  -
> http://npgsql.projects.postgresql.org/docs/manual/UserManual.html and
> look for "Working with binary data and bytea datatype".
>
>
> --
> Milen A. Radev
>
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>



-- 
Thanks And Regards,
VENKATRAO TAMMINENI


Re: [SQL] Re: How to insert Images(bnp,png,etc) into Postgresql and how to retrive the inserted Imaged using C#.net

2008-12-18 Thread Steve Crawford

venkat wrote:

HI Milen,

  Thanks for your great response,I do not find anything like insert 
images.. I have seen the whole tutorial..Please can you give me some 
example to insert images into postgresql.


I am waiting for your great response.


PostgreSQL has a general binary datatype called "bytea". There is no 
specific data type of "image", "jpg", "png", etc.


It is up to you to read the binary data, be it images, audio, or 
whatever and store them in your "bytea" column. As previously suggested, 
scroll down to the part titled "Working with binary data and bytea 
datatype" and try the example code there. Just feed it your images as 
input and all should be good.


Cheers,
Steve

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


[SQL] index compatible date_trunc in postgres?

2008-12-18 Thread Bryce Nesbitt
I've got a legacy app that does 8.3 incompatible date searches like so:
explain select count(*) from contexts where publication_date like '2006%';
explain select count(*) from contexts where publication_date like
'2006-09%';

I've got my choice of refactoring, but all these share the same
sequential scan limitation:
explain select count(*) from contexts where publication_date::text LIKE
'2006%';
explain select count(*) from contexts where
date_trunc('year',publication_date) = '2006-01-01';
explain select count(*) from contexts where extract('year' from
publication_date) = '2006';

Are there any other index compatible methods, other than turning it into
a range search?
explain select count(*) from contexts where publication_date >=
'2006-01-01' and publication_date < '2007-01-01';
explain select count(*) from contexts where publication_date >=
'2006-09-01' and publication_date < '2006-09-31 24:00:00';


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


Re: [SQL] index compatible date_trunc in postgres?

2008-12-18 Thread Scott Marlowe
On Thu, Dec 18, 2008 at 10:46 PM, Bryce Nesbitt  wrote:
> I've got a legacy app that does 8.3 incompatible date searches like so:
> explain select count(*) from contexts where publication_date like '2006%';
> explain select count(*) from contexts where publication_date like
> '2006-09%';
>
> I've got my choice of refactoring, but all these share the same
> sequential scan limitation:
> explain select count(*) from contexts where publication_date::text LIKE
> '2006%';
> explain select count(*) from contexts where
> date_trunc('year',publication_date) = '2006-01-01';
> explain select count(*) from contexts where extract('year' from
> publication_date) = '2006';
>
> Are there any other index compatible methods, other than turning it into
> a range search?
> explain select count(*) from contexts where publication_date >=
> '2006-01-01' and publication_date < '2007-01-01';
> explain select count(*) from contexts where publication_date >=
> '2006-09-01' and publication_date < '2006-09-31 24:00:00';

You can create an index on date_trunc (on timestamp without timezone,
but not on timestamp with timezone since it's not immutable)

create index mytable_datetrunc_month on mytable (date_trunc('month',
timestampfield));

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