Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: if table exists (DBI)

by erix (Vicar)
on Apr 26, 2013 at 16:47 UTC ( #1030864=note: print w/replies, xml ) Need Help??

in reply to Re: if table exists (DBI)
in thread if table exists (DBI)

this is only valid for MySQL,

PostgreSQL has IF [NOT] EXISTS for many objects; also for TABLE:

$ psql psql (9.2.4) Type "help" for help. # CREATE TABLE IF NOT EXISTS my_table (foo INT, bar VARCHAR (25) ); CREATE TABLE # \d my_table Table "public.my_table" Column | Type | Modifiers --------+-----------------------+----------- foo | integer | bar | character varying(25) |

( So there is also: DROP <object> IF EXISTS ... ;

# drop table if exists my_table; -- exists DROP TABLE # drop table if exists my_table; -- no table is no problem: DROP TABLE #


Of course postgres can also ROLLBACK on DDL statements. Not many DBMS's implement *that*, I think.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030864]
[thepkd]: $aohoaoh ->{'foo'} has to be dereferenced to access its contents right?
[thepkd]: sorry. i mean $aohoaoh[0]
[GotToBTru]: $aohoaoh is an array reference tho
[thepkd]: some guy was suggesting $aohoaoh[0]->{'foo '}[0]->{}. This wouldnt work.
[GotToBTru]: you're mixing notation there I think
[GotToBTru]: $aohoaoh->[0] is a hash reference, so $aohoaoh->[0]->{ key1} would work
[1nickt]: If 1nickt is the some guy, that's not what he said.
[GotToBTru]: thepkd might not know about last hour of cb

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2016-12-06 13:37 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (105 votes). Check out past polls.