Re: Copying data from a CSV file into a table dynamically

2018-08-14 Thread Ruiqiang Chen
CSV file has no limitation of # of rows, excel max row is 2^20. Am I
correct?

On Tue, Aug 14, 2018 at 9:46 AM, Ron  wrote:

> On 08/14/2018 08:38 AM, pavan95 wrote:
>
>> Hi Adrian,
>>
>> I tried to use
>> *"COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-`date --date="0 days
>> ago"
>> +%Y-%m-%d`_*.csv' WITH csv;"*
>>
>> But it resulted in an error. How to issue such that it is understandable
>> by
>> psql?
>>
>> And I am completely unaware of python & psycopg2. Anything which suits my
>> requirement is enough!!ostgresql-archive.org/
>> PostgreSQL-general-f1843780.html
>>
>
> Why not:
> cat /tmp/abc/xyz/postgresql-`date --date="0 days ago"+%Y-%m-%d`_*.csv' | \
>psql YOURDB -c "COPY postgres_log1 FROM STDIN WITH csv;"
>
> --
> Angular momentum makes the world go 'round.
>
>


searching a value in a variable/field in all tables in a schema

2018-08-30 Thread Ruiqiang Chen
Does anyone have experience of searching a value in a variable/field in all
tables in a schema?

If you can provide some code not creating stored procedure that would be
great.

Thanks,
Ray


Re: searching a value in a variable/field in all tables in a schema

2018-08-30 Thread Ruiqiang Chen
Thanks!

On Thu, Aug 30, 2018 at 4:51 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:

> On Thu, Aug 30, 2018 at 1:44 PM, Ruiqiang Chen 
> wrote:
>
>> Does anyone have experience of searching a value in a variable/field in
>> all tables in a schema?
>>
>
> SELECT 'Tbl1'::text AS loc, fld
> FROM schema.tbl1
> WHERE fld = 'value'
> [UNION ALL
> SELECT 'Tbl2'::text AS loc, fld
> FROM schema.tbl2
> WHERE fld = 'value'
> ...]
>
> David J.
>
>